void lttv_print_field(LttEvent *e, LttField *f, GString *s,
gboolean field_names, guint element_index) {
void lttv_print_field(LttEvent *e, LttField *f, GString *s,
gboolean field_names, guint element_index) {
if(field_names) {
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
if(field_names) {
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
- g_string_append_printf(s, "%lld", ltt_event_get_long_int(e,f));
- break;
+
+ //g_string_append_printf(s, "%lld", ltt_event_get_long_int(e,f));
+ g_string_append_printf(s, type->fmt, ltt_event_get_long_int(e,f));
+ break;
if(field_names) {
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
if(field_names) {
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
- g_string_append_printf(s, "%llu", ltt_event_get_long_unsigned(e,f));
+ // g_string_append_printf(s, "%llu", ltt_event_get_long_unsigned(e,f));
+ g_string_append_printf(s, type->fmt, ltt_event_get_long_unsigned(e,f));
- g_string_append_printf(s, "%c", car);
+ //g_string_append_printf(s, "%c", car);
+ g_string_append_printf(s, type->fmt, car);
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
- g_string_append_printf(s, "%g", ltt_event_get_double(e,f));
+ //g_string_append_printf(s, "%g", ltt_event_get_double(e,f));
+ g_string_append_printf(s, type->fmt, ltt_event_get_double(e,f));
if(field_names) {
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
if(field_names) {
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
- g_string_append_printf(s, "0x%llx", ltt_event_get_long_unsigned(e,f));
+ // g_string_append_printf(s, "0x%llx", ltt_event_get_long_unsigned(e,f));
+ g_string_append_printf(s, type->fmt, ltt_event_get_long_unsigned(e,f));
if(field_names) {
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
if(field_names) {
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
- g_string_append_printf(s, "{ ");
+ // g_string_append_printf(s, "{ ");
+ //Insert header
+ g_string_append_printf(s, type->header);//tested, works fine.
+
+
nb = ltt_event_field_element_number(e,f);
for(i = 0 ; i < nb ; i++) {
LttField *child = ltt_event_field_element_select(e,f,i);
lttv_print_field(e, child, s, field_names, i);
nb = ltt_event_field_element_number(e,f);
for(i = 0 ; i < nb ; i++) {
LttField *child = ltt_event_field_element_select(e,f,i);
lttv_print_field(e, child, s, field_names, i);
- g_string_append_printf(s, " }");
+ //g_string_append_printf(s, " }");
+ //Insert footer
+ g_string_append_printf(s, type->footer);//tested, works fine.
if(field_names) {
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
if(field_names) {
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
- g_string_append_printf(s, "{ ");
+ // g_string_append_printf(s, "{ ");
+ //Insert header
+ g_string_append_printf(s, type->header);
+
nb = ltt_type_member_number(type);
for(i = 0 ; i < nb ; i++) {
LttField *element;
element = ltt_field_member(f,i);
lttv_print_field(e, element, s, field_names, i);
nb = ltt_type_member_number(type);
for(i = 0 ; i < nb ; i++) {
LttField *element;
element = ltt_field_member(f,i);
lttv_print_field(e, element, s, field_names, i);
- g_string_append_printf(s, " }");
+ //g_string_append_printf(s, " }");
+ //Insert footer
+ g_string_append_printf(s, type->footer);
if(field_names) {
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
if(field_names) {
name = ltt_field_name(f);
if(name)
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
- g_string_append_printf(s, "{ ");
+ // g_string_append_printf(s, "{ ");
+ g_string_append_printf(s, type->header);
+
nb = ltt_type_member_number(type);
for(i = 0 ; i < nb ; i++) {
LttField *element;
element = ltt_field_member(f,i);
lttv_print_field(e, element, s, field_names, i);
nb = ltt_type_member_number(type);
for(i = 0 ; i < nb ; i++) {
LttField *element;
element = ltt_field_member(f,i);
lttv_print_field(e, element, s, field_names, i);
- g_string_append_printf(s, " }");
+ // g_string_append_printf(s, " }");
+ g_string_append_printf(s, type->footer);
void lttv_event_to_string(LttEvent *e, GString *s,
gboolean mandatory_fields, gboolean field_names, LttvTracefileState *tfs)
{
void lttv_event_to_string(LttEvent *e, GString *s,
gboolean mandatory_fields, gboolean field_names, LttvTracefileState *tfs)
{
g_quark_to_string(ltt_facility_name(facility)),
g_quark_to_string(ltt_eventtype_name(event_type)),
(long)time.tv_sec, time.tv_nsec,
g_quark_to_string(ltt_facility_name(facility)),
g_quark_to_string(ltt_eventtype_name(event_type)),
(long)time.tv_sec, time.tv_nsec,
g_quark_to_string(ltt_tracefile_name(tfs->parent.tf)),
cpu);
/* Print the process id and the state/interrupt type of the process */
g_quark_to_string(ltt_tracefile_name(tfs->parent.tf)),
cpu);
/* Print the process id and the state/interrupt type of the process */
for(i=0; i<num_fields; i++) {
field = ltt_eventtype_field(event_type, i);
lttv_print_field(e, field, s, field_names, i);
for(i=0; i<num_fields; i++) {
field = ltt_eventtype_field(event_type, i);
lttv_print_field(e, field, s, field_names, i);