12 #ifndef ROC_CORE_CSV_DUMPER_H_
13 #define ROC_CORE_CSV_DUMPER_H_
19 #include "roc_core/semaphore.h"
29 static const size_t Csv_MaxFields = 10;
95 bool open_(
const char* path);
Asynchronous CSV dumper. Writes entries to CSV file from background thread. Recommended to be used fr...
bool is_valid() const
Check if opened without errors.
bool would_write(char type)
Check whether write() would enqueue or drop entry. Lock-free operation.
CsvDumper(const char *path, const CsvConfig &config, IArena &arena)
Open file. path - output file. max_interval - maximum number of writes per second for each entry type...
void stop()
Stop background thread.
void write(const CsvEntry &entry)
Enqueue entry for writing. Makes a copy of entry and pushes it to a lock-free ring buffer....
Optionally constructed object.
Thread-safe lock-free single-producer single-consumer circular buffer of copyable objects.
Base class for thread objects.
const nanoseconds_t Millisecond
One millisecond represented in nanoseconds.
int64_t nanoseconds_t
Nanoseconds.
Optionally constructed object.
Single-producer single-consumer circular buffer of copyable objects.
Commonly used types and functions.
size_t max_queued
Maximum number of queued entries. If queue becomes larger, entries are dropped.
nanoseconds_t max_interval
Maximum allowed interval between subsequent entries of same type. If zero, there is no limit....
CSV entry. Corresponds to one line in output file.
char type
One-character entry type (first field).
size_t n_fields
Number of fields.
double fields[Csv_MaxFields]
Fields.