40 #ifndef included_clib_elog_h 41 #define included_clib_elog_h 97 char * enum_strings[];
220 word type_index, track_index;
249 e->
type = type_index;
250 e->
track = track_index;
341 #define __ELOG_TYPE_VAR(f) f 342 #define __ELOG_TRACK_VAR(f) f 344 #define ELOG_TYPE_DECLARE(f) static elog_event_type_t __ELOG_TYPE_VAR(f) 346 #define ELOG_TYPE_INIT_FORMAT_AND_FUNCTION(fmt,func) \ 347 { .format = fmt, .function = func, } 349 #define ELOG_TYPE_INIT(fmt) \ 350 ELOG_TYPE_INIT_FORMAT_AND_FUNCTION(fmt,(char *) __FUNCTION__) 352 #define ELOG_TYPE_DECLARE_HELPER(f,fmt,func) \ 353 static elog_event_type_t __ELOG_TYPE_VAR(f) = \ 354 ELOG_TYPE_INIT_FORMAT_AND_FUNCTION (fmt, func) 356 #define ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION(f,fmt) \ 357 ELOG_TYPE_DECLARE_HELPER (f, fmt, (char *) __FUNCTION__) 359 #define ELOG_TYPE_DECLARE_FORMAT(f,fmt) \ 360 ELOG_TYPE_DECLARE_HELPER (f, fmt, 0) 364 #define ELOG_TYPE(f,fmt) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION(f,fmt) 365 #define ELOG_TYPE_D(f) ELOG_TYPE_DECLARE_FORMAT (f, #f " %d") 366 #define ELOG_TYPE_X(f) ELOG_TYPE_DECLARE_FORMAT (f, #f " 0x%x") 367 #define ELOG_TYPE_DF(f) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " %d") 368 #define ELOG_TYPE_XF(f) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " 0x%x") 369 #define ELOG_TYPE_FD(f) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " %d") 370 #define ELOG_TYPE_FX(f) ELOG_TYPE_DECLARE_FORMAT_AND_FUNCTION (f, #f " 0x%x") 372 #define ELOG_TRACK_DECLARE(f) static elog_track_t __ELOG_TRACK_VAR(f) 373 #define ELOG_TRACK(f) ELOG_TRACK_DECLARE(f) = { .name = #f, } 376 #define ELOG(em,f,data) elog ((em), &__ELOG_TYPE_VAR(f), data) 377 #define ELOG_INLINE(em,f,data) elog_inline ((em), &__ELOG_TYPE_VAR(f), data) 380 #define ELOG_TRACK_DATA(em,f,track) \ 381 elog_data ((em), &__ELOG_TYPE_VAR(f), &__ELOG_TRACK_VAR(track)) 382 #define ELOG_TRACK_DATA_INLINE(em,f,track) \ 383 elog_data_inline ((em), &__ELOG_TYPE_VAR(f), &__ELOG_TRACK_VAR(track)) 386 #define ELOG_DATA(em,f) elog_data ((em), &__ELOG_TYPE_VAR (f), &(em)->default_track) 387 #define ELOG_DATA_INLINE(em,f) elog_data_inline ((em), &__ELOG_TYPE_VAR (f), &(em)->default_track) char ** enum_strings_vector
elog_time_stamp_t serialize_time
u32 elog_string(elog_main_t *em, char *format,...)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
always_inline uword elog_buffer_capacity(elog_main_t *em)
always_inline void * elog_data(elog_main_t *em, elog_event_type_t *type, elog_track_t *track)
void serialize_elog_main(serialize_main_t *m, va_list *va)
u8 * format_elog_event(u8 *s, va_list *va)
always_inline void * elog_data_inline(elog_main_t *em, elog_event_type_t *type, elog_track_t *track)
always_inline void elog_reset_buffer(elog_main_t *em)
word elog_event_type_register(elog_main_t *em, elog_event_type_t *t)
always_inline void elog(elog_main_t *em, elog_event_type_t *type, u32 data)
void unserialize_elog_main(serialize_main_t *m, va_list *va)
always_inline void elog_disable_trigger(elog_main_t *em)
always_inline uword elog_is_enabled(elog_main_t *em)
always_inline void elog_enable_disable(elog_main_t *em, int is_enabled)
#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)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
always_inline void elog_inline(elog_main_t *em, elog_event_type_t *type, u32 data)
always_inline void elog_track(elog_main_t *em, elog_event_type_t *type, elog_track_t *track, u32 data)
uword * event_type_by_format
elog_event_type_t * event_types
void elog_init(elog_main_t *em, u32 n_events)
always_inline clib_error_t * elog_read_file(elog_main_t *em, char *unix_file)
void elog_alloc(elog_main_t *em, u32 n_events)
always_inline void elog_disable_after_events(elog_main_t *em, uword n)
elog_event_t * event_ring
always_inline void * elog_event_data_inline(elog_main_t *em, elog_event_type_t *type, elog_track_t *track, u64 cpu_time)
word elog_track_register(elog_main_t *em, elog_track_t *t)
always_inline void * elog_event_data_not_inline(elog_main_t *em, elog_event_type_t *type, elog_track_t *track, u64 cpu_time)
clib_error_t * serialize(serialize_main_t *m,...)
always_inline uword elog_n_events_in_buffer(elog_main_t *em)
u32 n_total_events_disable_limit
void unserialize_close(serialize_main_t *m)
always_inline uword is_pow2(uword x)
void elog_time_now(elog_time_stamp_t *et)
void serialize_close(serialize_main_t *m)
clib_error_t * unserialize(serialize_main_t *m,...)
always_inline void elog_track_inline(elog_main_t *em, elog_event_type_t *type, elog_track_t *track, u32 data)
u8 * format_elog_track(u8 *s, va_list *va)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
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)
always_inline u64 clib_cpu_time_now(void)
always_inline clib_error_t * elog_write_file(elog_main_t *em, char *unix_file)
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)