FD.io VPP
v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
|
The fine-grained event logger allows lightweight, thread-safe event logging at minimum cost. More...
Go to the source code of this file.
Data Structures | |
struct | elog_event_t |
struct | elog_event_type_t |
struct | elog_track_t |
struct | elog_time_stamp_t |
struct | elog_main_t |
Macros | |
#define | ELOG_TYPE_DECLARE(f) static elog_event_type_t __ELOG_TYPE_VAR(f) |
#define | ELOG_TYPE_INIT_FORMAT_AND_FUNCTION(fmt, func) { .format = fmt, .function = func, } |
#define | ELOG_TYPE_INIT(fmt) ELOG_TYPE_INIT_FORMAT_AND_FUNCTION(fmt,(char *) __FUNCTION__) |
#define | ELOG_TYPE_DECLARE_HELPER(f, fmt, func) |
#define | ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION(f, fmt) ELOG_TYPE_DECLARE_HELPER (f, fmt, (char *) __FUNCTION__) |
#define | ELOG_TYPE_DECLARE_FORMAT(f, fmt) ELOG_TYPE_DECLARE_HELPER (f, fmt, 0) |
#define | ELOG_TYPE(f, fmt) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION(f,fmt) |
#define | ELOG_TYPE_D(f) ELOG_TYPE_DECLARE_FORMAT (f, #f " %d") |
#define | ELOG_TYPE_X(f) ELOG_TYPE_DECLARE_FORMAT (f, #f " 0x%x") |
#define | ELOG_TYPE_DF(f) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " %d") |
#define | ELOG_TYPE_XF(f) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " 0x%x") |
#define | ELOG_TYPE_FD(f) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " %d") |
#define | ELOG_TYPE_FX(f) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " 0x%x") |
#define | ELOG_TRACK_DECLARE(f) static elog_track_t __ELOG_TRACK_VAR(f) |
#define | ELOG_TRACK(f) ELOG_TRACK_DECLARE(f) = { .name = #f, } |
#define | ELOG(em, f, data) elog ((em), &__ELOG_TYPE_VAR(f), data) |
#define | ELOG_INLINE(em, f, data) elog_inline ((em), &__ELOG_TYPE_VAR(f), data) |
#define | ELOG_TRACK_DATA(em, f, track) elog_data ((em), &__ELOG_TYPE_VAR(f), &__ELOG_TRACK_VAR(track)) |
#define | ELOG_TRACK_DATA_INLINE(em, f, track) elog_data_inline ((em), &__ELOG_TYPE_VAR(f), &__ELOG_TRACK_VAR(track)) |
#define | ELOG_DATA(em, f) elog_data ((em), &__ELOG_TYPE_VAR (f), &(em)->default_track) |
#define | ELOG_DATA_INLINE(em, f) elog_data_inline ((em), &__ELOG_TYPE_VAR (f), &(em)->default_track) |
Functions | |
static uword | elog_n_events_in_buffer (elog_main_t *em) |
Return number of events in the event-log buffer. More... | |
static uword | elog_buffer_capacity (elog_main_t *em) |
Return number of events which can fit in the event buffer. More... | |
static void | elog_reset_buffer (elog_main_t *em) |
Reset the event buffer. More... | |
static void | elog_enable_disable (elog_main_t *em, int is_enabled) |
Enable or disable event logging. More... | |
static void | elog_disable_after_events (elog_main_t *em, uword n) |
disable logging after specified number of ievents have been logged. More... | |
static void | elog_disable_trigger (elog_main_t *em) |
word | elog_event_type_register (elog_main_t *em, elog_event_type_t *t) |
register an event type More... | |
word | elog_track_register (elog_main_t *em, elog_track_t *t) |
register an event track More... | |
static uword | elog_is_enabled (elog_main_t *em) |
event logging enabled predicate More... | |
static void * | elog_event_data_inline (elog_main_t *em, elog_event_type_t *type, elog_track_t *track, u64 cpu_time) |
Allocate an event to be filled in by the caller. More... | |
void * | elog_event_data (elog_main_t *em, elog_event_type_t *type, elog_track_t *track, u64 cpu_time) |
static void * | elog_event_data_not_inline (elog_main_t *em, elog_event_type_t *type, elog_track_t *track, u64 cpu_time) |
Allocate an event to be filled in by the caller, non-inline. More... | |
static void | elog (elog_main_t *em, elog_event_type_t *type, u32 data) |
Log a single-datum event. More... | |
static void | elog_inline (elog_main_t *em, elog_event_type_t *type, u32 data) |
Log a single-datum event, inline version. More... | |
static void | elog_track (elog_main_t *em, elog_event_type_t *type, elog_track_t *track, u32 data) |
Log a single-datum event to a specific track, non-inline version. More... | |
static void | elog_track_inline (elog_main_t *em, elog_event_type_t *type, elog_track_t *track, u32 data) |
Log a single-datum event to a specific track. More... | |
static void * | elog_data (elog_main_t *em, elog_event_type_t *type, elog_track_t *track) |
static void * | elog_data_inline (elog_main_t *em, elog_event_type_t *type, elog_track_t *track) |
u32 | elog_string (elog_main_t *em, char *format,...) |
add a string to the event-log string table More... | |
void | elog_time_now (elog_time_stamp_t *et) |
elog_event_t * | elog_get_events (elog_main_t *em) |
convert event ring events to events, and return them as a vector. More... | |
elog_event_t * | elog_peek_events (elog_main_t *em) |
convert event ring events to events, and return them as a vector. More... | |
void | elog_merge (elog_main_t *dst, u8 *dst_tag, elog_main_t *src, u8 *src_tag, f64 align_tweak) |
u8 * | format_elog_event (u8 *s, va_list *va) |
u8 * | format_elog_track_name (u8 *s, va_list *va) |
u8 * | format_elog_track (u8 *s, va_list *args) |
void | serialize_elog_main (serialize_main_t *m, va_list *va) |
void | unserialize_elog_main (serialize_main_t *m, va_list *va) |
void | elog_init (elog_main_t *em, u32 n_events) |
void | elog_alloc (elog_main_t *em, u32 n_events) |
static clib_error_t * | elog_write_file (elog_main_t *em, char *clib_file, int flush_ring) |
static clib_error_t * | elog_read_file (elog_main_t *em, char *clib_file) |
The fine-grained event logger allows lightweight, thread-safe event logging at minimum cost.
In typical operation, logging a single event costs around 80ns on x86_64. It's appropriate for at-least per-frame event-logging in vector packet processing.
See https://wiki.fd.io/view/VPP/elog for more information.
Definition in file elog.h.
#define ELOG_DATA | ( | em, | |
f | |||
) | elog_data ((em), &__ELOG_TYPE_VAR (f), &(em)->default_track) |
#define ELOG_DATA_INLINE | ( | em, | |
f | |||
) | elog_data_inline ((em), &__ELOG_TYPE_VAR (f), &(em)->default_track) |
#define ELOG_INLINE | ( | em, | |
f, | |||
data | |||
) | elog_inline ((em), &__ELOG_TYPE_VAR(f), data) |
#define ELOG_TRACK | ( | f | ) | ELOG_TRACK_DECLARE(f) = { .name = #f, } |
#define ELOG_TRACK_DATA | ( | em, | |
f, | |||
track | |||
) | elog_data ((em), &__ELOG_TYPE_VAR(f), &__ELOG_TRACK_VAR(track)) |
#define ELOG_TRACK_DATA_INLINE | ( | em, | |
f, | |||
track | |||
) | elog_data_inline ((em), &__ELOG_TYPE_VAR(f), &__ELOG_TRACK_VAR(track)) |
#define ELOG_TRACK_DECLARE | ( | f | ) | static elog_track_t __ELOG_TRACK_VAR(f) |
#define ELOG_TYPE | ( | f, | |
fmt | |||
) | ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION(f,fmt) |
#define ELOG_TYPE_D | ( | f | ) | ELOG_TYPE_DECLARE_FORMAT (f, #f " %d") |
#define ELOG_TYPE_DECLARE | ( | f | ) | static elog_event_type_t __ELOG_TYPE_VAR(f) |
#define ELOG_TYPE_DECLARE_FORMAT | ( | f, | |
fmt | |||
) | ELOG_TYPE_DECLARE_HELPER (f, fmt, 0) |
#define ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION | ( | f, | |
fmt | |||
) | ELOG_TYPE_DECLARE_HELPER (f, fmt, (char *) __FUNCTION__) |
#define ELOG_TYPE_DECLARE_HELPER | ( | f, | |
fmt, | |||
func | |||
) |
#define ELOG_TYPE_DF | ( | f | ) | ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " %d") |
#define ELOG_TYPE_FD | ( | f | ) | ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " %d") |
#define ELOG_TYPE_FX | ( | f | ) | ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " 0x%x") |
#define ELOG_TYPE_INIT | ( | fmt | ) | ELOG_TYPE_INIT_FORMAT_AND_FUNCTION(fmt,(char *) __FUNCTION__) |
#define ELOG_TYPE_INIT_FORMAT_AND_FUNCTION | ( | fmt, | |
func | |||
) | { .format = fmt, .function = func, } |
#define ELOG_TYPE_X | ( | f | ) | ELOG_TYPE_DECLARE_FORMAT (f, #f " 0x%x") |
#define ELOG_TYPE_XF | ( | f | ) | ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " 0x%x") |
|
inlinestatic |
Log a single-datum event.
em | elog_main_t * |
type | elog_event_type_t * type |
data | u32 single datum to capture |
Definition at line 367 of file elog.h.
void elog_alloc | ( | elog_main_t * | em, |
u32 | n_events | ||
) |
|
inlinestatic |
Return number of events which can fit in the event buffer.
em | elog_main_t * |
Definition at line 201 of file elog.h.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
disable logging after specified number of ievents have been logged.
This is used as a "debug trigger" when a certain event has occurred. Events will be logged both before and after the "event" but the event will not be lost as long as N < RING_SIZE.
em | elog_main_t * |
n | uword number of events before disabling event logging |
|
inlinestatic |
|
inlinestatic |
Enable or disable event logging.
em | elog_main_t * |
Definition at line 220 of file elog.h.
void* elog_event_data | ( | elog_main_t * | em, |
elog_event_type_t * | type, | ||
elog_track_t * | track, | ||
u64 | cpu_time | ||
) |
|
inlinestatic |
Allocate an event to be filled in by the caller.
Not normally called directly; this function underlies the ELOG_DATA and ELOG_TRACK_DATA macros
em | elog_main_t * |
type | elog_event_type_t * type |
track | elog_track_t * track |
cpu_time | u64 current cpu tick value |
Definition at line 293 of file elog.h.
|
inlinestatic |
Allocate an event to be filled in by the caller, non-inline.
Not normally called directly; this function underlies the ELOG_DATA and ELOG_TRACK_DATA macros
em | elog_main_t * |
type | elog_event_type_t * type |
track | elog_track_t * track |
cpu_time | u64 current cpu tick value |
Definition at line 351 of file elog.h.
word elog_event_type_register | ( | elog_main_t * | em, |
elog_event_type_t * | t | ||
) |
register an event type
em | elog_main_t * |
t | elog_event_type_t * event to register |
Definition at line 104 of file elog.c.
elog_event_t* elog_get_events | ( | elog_main_t * | em | ) |
convert event ring events to events, and return them as a vector.
em | elog_main_t * |
Definition at line 604 of file elog.c.
void elog_init | ( | elog_main_t * | em, |
u32 | n_events | ||
) |
|
inlinestatic |
Log a single-datum event, inline version.
em | elog_main_t * |
type | elog_event_type_t * type |
data | u32 single datum to capture |
Definition at line 382 of file elog.h.
|
inlinestatic |
event logging enabled predicate
em | elog_main_t * |
Definition at line 276 of file elog.h.
void elog_merge | ( | elog_main_t * | dst, |
u8 * | dst_tag, | ||
elog_main_t * | src, | ||
u8 * | src_tag, | ||
f64 | align_tweak | ||
) |
|
inlinestatic |
Return number of events in the event-log buffer.
em | elog_main_t * |
Definition at line 191 of file elog.h.
elog_event_t* elog_peek_events | ( | elog_main_t * | em | ) |
convert event ring events to events, and return them as a vector.
em | elog_main_t * |
Definition at line 537 of file elog.c.
|
inlinestatic |
|
inlinestatic |
Reset the event buffer.
em | elog_main_t * |
Definition at line 210 of file elog.h.
u32 elog_string | ( | elog_main_t * | em, |
char * | format, | ||
... | |||
) |
add a string to the event-log string table
Often combined with hashing and the T4 elog format specifier to display complex strings in offline tooling
em | elog_main_t * |
format | char * |
VARARGS |
Definition at line 562 of file elog.c.
void elog_time_now | ( | elog_time_stamp_t * | et | ) |
|
inlinestatic |
Log a single-datum event to a specific track, non-inline version.
em | elog_main_t * |
type | elog_event_type_t * type |
type | elog_event_track_t * track |
data | u32 single datum to capture |
Definition at line 398 of file elog.h.
|
inlinestatic |
Log a single-datum event to a specific track.
em | elog_main_t * |
type | elog_event_type_t * type |
type | elog_event_track_t * track |
data | u32 single datum to capture |
Definition at line 415 of file elog.h.
word elog_track_register | ( | elog_main_t * | em, |
elog_track_t * | t | ||
) |
register an event track
em | elog_main_t * |
t | elog_track_t * track to register |
Definition at line 198 of file elog.c.
|
inlinestatic |
void serialize_elog_main | ( | serialize_main_t * | m, |
va_list * | va | ||
) |
void unserialize_elog_main | ( | serialize_main_t * | m, |
va_list * | va | ||
) |