FD.io VPP
v21.01.1
Vector Packet Processing
|
mmap-based thread-safe fixed-size record double-buffered logging. More...
Go to the source code of this file.
Data Structures | |
struct | clib_maplog_header_t |
Maplog log file header segment. More... | |
struct | clib_maplog_main_t |
Process-private main data structure. More... | |
struct | clib_maplog_init_args_t |
log initialization structure More... | |
Macros | |
#define | MAPLOG_MAJOR_VERSION 1 |
#define | MAPLOG_MINOR_VERSION 1 |
#define | MAPLOG_PATCH_VERSION 0 |
#define | CLIB_MAPLOG_FLAG_INIT (1<<0) |
#define | CLIB_MAPLOG_FLAG_CIRCULAR (1<<1) |
#define | CLIB_MAPLOG_FLAG_WRAPPED (1<<2) |
Functions | |
int | clib_maplog_init (clib_maplog_init_args_t *ap) |
Initialize a maplog object. More... | |
void | clib_maplog_update_header (clib_maplog_main_t *mm) |
Update a mapped log header file. More... | |
void | clib_maplog_close (clib_maplog_main_t *mm) |
Close a mapped log, and update the log header file. More... | |
int | clib_maplog_process (char *file_basename, void *fp_arg) |
Process a complete maplog. More... | |
static void * | clib_maplog_get_entry (clib_maplog_main_t *mm) |
Obtain a log entry pointer. More... | |
Variables | |
format_function_t | format_maplog_header |
mmap-based thread-safe fixed-size record double-buffered logging.
This scheme should be about as fast as practicable. By fiat, log records are rounded to a multiple of CLIB_CACHE_LINE_BYTES. Consumer code calls clib_maplog_get_entry(...) to obtain a pointer to a log entry.
We use an atomic ticket-counter to dole out log entries. Whichever client thread crosses the double-buffer boundary is in charge of replacing the log segment which just filled.
Definition in file maplog.h.
void clib_maplog_close | ( | clib_maplog_main_t * | mm | ) |
|
inlinestatic |
Obtain a log entry pointer.
Increments the atomic ticket counter, and returns a pointer to the newly-allocated log entry. The slowpath function replaces a full log segment with a new/fresh/empty log segment
[in] | mm | maplog object pointer |
int clib_maplog_init | ( | clib_maplog_init_args_t * | a | ) |
int clib_maplog_process | ( | char * | file_basename, |
void * | fp_arg | ||
) |
Process a complete maplog.
Reads the maplog header. Map and process all log segments in order. Calls the callback function once per file with a record count.
Note: if the file header isn't updated by calling clib_maplog_close(), it will appear to have an infinite number of records in an infinite number of files.
So long as the callback function understands that possibility
[in] | file_basename | Same basename supplied to clib_maplog_init |
[in] | fp_arg | Callback function pointer |
void clib_maplog_update_header | ( | clib_maplog_main_t * | mm | ) |
format_function_t format_maplog_header |