2 void lttv_event_to_string(ltt_event
*e
, lttv_string
*s
, bool mandatory_fields
)
4 ltt_facility
*facility
;
5 ltt_eventtype
*eventtype
;
10 g_string_set_size(s
,0);
12 facility
= lttv_event_facility(e
);
13 eventtype
= ltt_event_eventtype(e
);
14 field
= ltt_event_field(e
);
16 if(mandatory_fields
) {
17 time
= ltt_event_time(e
);
18 g_string_append_printf(s
,"%s.%s: %ld.%ld",ltt_facility_name(facility
),
19 ltt_eventtype_name(eventtype
), (long)time
.tv_sec
, time
.tv_nsec
);
25 void print_field(ltt_event
*e
, ltt_field
*f
, lttv_string
*s
) {
31 type
= ltt_field_type(f
);
32 switch(ltt_type_class(type
)) {
34 g_string_append_printf(s
, " %ld", ltt_event_get_long_int(e
,f
));
38 g_string_append_printf(s
, " %lu", ltt_event_get_long_unsigned(e
,f
));
42 g_string_append_printf(s
, " %g", ltt_event_get_double(e
,f
));
46 g_string_append_printf(s
, " \"%s\"", ltt_event_get_string(e
,f
));
50 g_string_append_printf(s
, " %s", ltt_enum_string_get(type
,
51 event_get_unsigned(e
,f
));
56 g_string_append_printf(s
, " {");
57 nb
= ltt_event_field_element_number(e
,f
);
58 element
= ltt_field_element(f
);
59 for(i
= 0 ; i
< nb
; i
++) {
60 ltt_event_field_element_select(e
,f
,i
);
61 print_field(e
,element
,s
);
63 g_string_append_printf(s
, " }");
67 g_string_append_printf(s
, " {");
68 nb
= ltt_type_member_number(type
);
69 for(i
= 0 ; i
< nb
; i
++) {
70 element
= ltt_field_member(f
,i
);
71 print_field(e
,element
,s
);
73 g_string_append_printf(s
, " }");
This page took 0.032904 seconds and 4 git commands to generate.