40 #ifndef included_clib_elog_h 41 #define included_clib_elog_h 100 char *enum_strings[];
236 word type_index, track_index;
265 e->
type = type_index;
266 e->
track = track_index;
347 #define __ELOG_TYPE_VAR(f) f 348 #define __ELOG_TRACK_VAR(f) f 350 #define ELOG_TYPE_DECLARE(f) static elog_event_type_t __ELOG_TYPE_VAR(f) 352 #define ELOG_TYPE_INIT_FORMAT_AND_FUNCTION(fmt,func) \ 353 { .format = fmt, .function = func, } 355 #define ELOG_TYPE_INIT(fmt) \ 356 ELOG_TYPE_INIT_FORMAT_AND_FUNCTION(fmt,(char *) __FUNCTION__) 358 #define ELOG_TYPE_DECLARE_HELPER(f,fmt,func) \ 359 static elog_event_type_t __ELOG_TYPE_VAR(f) = \ 360 ELOG_TYPE_INIT_FORMAT_AND_FUNCTION (fmt, func) 362 #define ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION(f,fmt) \ 363 ELOG_TYPE_DECLARE_HELPER (f, fmt, (char *) __FUNCTION__) 365 #define ELOG_TYPE_DECLARE_FORMAT(f,fmt) \ 366 ELOG_TYPE_DECLARE_HELPER (f, fmt, 0) 370 #define ELOG_TYPE(f,fmt) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION(f,fmt) 371 #define ELOG_TYPE_D(f) ELOG_TYPE_DECLARE_FORMAT (f, #f " %d") 372 #define ELOG_TYPE_X(f) ELOG_TYPE_DECLARE_FORMAT (f, #f " 0x%x") 373 #define ELOG_TYPE_DF(f) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " %d") 374 #define ELOG_TYPE_XF(f) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " 0x%x") 375 #define ELOG_TYPE_FD(f) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " %d") 376 #define ELOG_TYPE_FX(f) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " 0x%x") 378 #define ELOG_TRACK_DECLARE(f) static elog_track_t __ELOG_TRACK_VAR(f) 379 #define ELOG_TRACK(f) ELOG_TRACK_DECLARE(f) = { .name = #f, } 382 #define ELOG(em,f,data) elog ((em), &__ELOG_TYPE_VAR(f), data) 383 #define ELOG_INLINE(em,f,data) elog_inline ((em), &__ELOG_TYPE_VAR(f), data) 386 #define ELOG_TRACK_DATA(em,f,track) \ 387 elog_data ((em), &__ELOG_TYPE_VAR(f), &__ELOG_TRACK_VAR(track)) 388 #define ELOG_TRACK_DATA_INLINE(em,f,track) \ 389 elog_data_inline ((em), &__ELOG_TYPE_VAR(f), &__ELOG_TRACK_VAR(track)) 392 #define ELOG_DATA(em,f) elog_data ((em), &__ELOG_TYPE_VAR (f), &(em)->default_track) 393 #define ELOG_DATA_INLINE(em,f) elog_data_inline ((em), &__ELOG_TYPE_VAR (f), &(em)->default_track) static void elog_enable_disable(elog_main_t *em, int is_enabled)
char ** enum_strings_vector
elog_time_stamp_t serialize_time
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,...)
void serialize_elog_main(serialize_main_t *m, va_list *va)
u8 * format_elog_event(u8 *s, va_list *va)
static u64 clib_cpu_time_now(void)
word elog_event_type_register(elog_main_t *em, elog_event_type_t *t)
void unserialize_elog_main(serialize_main_t *m, va_list *va)
static void * elog_event_data_not_inline(elog_main_t *em, elog_event_type_t *type, elog_track_t *track, u64 cpu_time)
#define clib_smp_atomic_add(addr, increment)
clib_error_t * serialize_open_unix_file(serialize_main_t *m, char *file)
clib_error_t * unserialize_open_unix_file(serialize_main_t *m, char *file)
static void elog_disable_after_events(elog_main_t *em, uword n)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static clib_error_t * elog_write_file(elog_main_t *em, char *unix_file)
uword * event_type_by_format
elog_event_type_t * event_types
void elog_init(elog_main_t *em, u32 n_events)
static void elog_inline(elog_main_t *em, elog_event_type_t *type, u32 data)
void elog_alloc(elog_main_t *em, u32 n_events)
elog_event_t * event_ring
static void elog(elog_main_t *em, elog_event_type_t *type, u32 data)
word elog_track_register(elog_main_t *em, elog_track_t *t)
clib_error_t * serialize(serialize_main_t *m,...)
static uword elog_n_events_in_buffer(elog_main_t *em)
u32 n_total_events_disable_limit
void unserialize_close(serialize_main_t *m)
void elog_time_now(elog_time_stamp_t *et)
static void elog_reset_buffer(elog_main_t *em)
void serialize_close(serialize_main_t *m)
clib_error_t * unserialize(serialize_main_t *m,...)
static uword is_pow2(uword x)
u8 * format_elog_track(u8 *s, va_list *va)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static uword elog_is_enabled(elog_main_t *em)
static void elog_track(elog_main_t *em, elog_event_type_t *type, elog_track_t *track, u32 data)
static void * elog_data(elog_main_t *em, elog_event_type_t *type, elog_track_t *track)
static clib_error_t * elog_read_file(elog_main_t *em, char *unix_file)
elog_track_t default_track
elog_event_t * elog_get_events(elog_main_t *em)
elog_event_t * elog_peek_events(elog_main_t *em)
static void elog_track_inline(elog_main_t *em, elog_event_type_t *type, elog_track_t *track, u32 data)
void elog_merge(elog_main_t *dst, u8 *dst_tag, elog_main_t *src, u8 *src_tag)
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_inline(elog_main_t *em, elog_event_type_t *type, elog_track_t *track, u64 cpu_time)
static uword elog_buffer_capacity(elog_main_t *em)
static void elog_disable_trigger(elog_main_t *em)