X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2FtextDump.c;h=04bc344d0375ce4b99356d987c879e9cb7dde1c9;hb=07bb8c8f924eb5d84110a3c4dc2ea87ffbccf146;hp=646cb0812123ae9bc5d23baac04e3a465ac18515;hpb=c432246e06bb83a3d43a6668517486fb6b4b959d;p=lttv.git diff --git a/ltt/branches/poly/lttv/textDump.c b/ltt/branches/poly/lttv/textDump.c index 646cb081..04bc344d 100644 --- a/ltt/branches/poly/lttv/textDump.c +++ b/ltt/branches/poly/lttv/textDump.c @@ -59,7 +59,7 @@ void print_field(LttEvent *e, LttField *f, GString *s, gboolean field_names) { case LTT_ENUM: g_string_append_printf(s, " %s", ltt_enum_string_get(type, - event_get_unsigned(e,f))); + ltt_event_get_unsigned(e,f)-1)); break; case LTT_ARRAY: @@ -92,8 +92,8 @@ void print_field(LttEvent *e, LttField *f, GString *s, gboolean field_names) { void lttv_event_to_string(LttEvent *e, LttTracefile *tf, GString *s, - gboolean mandatory_fields, gboolean field_names) -{ + gboolean mandatory_fields, gboolean field_names, LttvTracefileState *tfs) +{ LttFacility *facility; LttEventType *event_type; @@ -116,9 +116,13 @@ void lttv_event_to_string(LttEvent *e, LttTracefile *tf, GString *s, ltt_eventtype_name(event_type), (long)time.tv_sec, time.tv_nsec, ltt_tracefile_name(tf)); /* Print the process id and the state/interrupt type of the process */ + g_string_append_printf(s,", %u, %u, %s", tfs->process->pid, + tfs->process->ppid, + g_quark_to_string(tfs->process->state->t)); } - print_field(e, field, s, field_names); + if(field) + print_field(e, field, s, field_names); } @@ -180,7 +184,8 @@ static int write_event_content(void *hook_data, void *call_data) e = tfc->e; - lttv_event_to_string(e, tfc->tf, a_string, TRUE, a_field_names); + lttv_event_to_string(e, tfc->tf, a_string, TRUE, a_field_names, tfs); + g_string_append_printf(a_string,"\n"); if(a_state) { g_string_append_printf(a_string, " %s", @@ -192,12 +197,24 @@ static int write_event_content(void *hook_data, void *call_data) } -void init(int argc, char **argv) +G_MODULE_EXPORT void init(LttvModule *self, int argc, char **argv) { LttvAttributeValue value; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); + LttvModule *batchAnalysis = + lttv_module_require(self, "batchAnalysis", argc, argv); + + if(batchAnalysis == NULL) + { + g_error("Can't load required module batchAnalysis"); + return; + } + + + a_string = g_string_new(""); + a_file_name = NULL; lttv_option_add("output", 'o', "output file where the text is written", @@ -238,7 +255,7 @@ void init(int argc, char **argv) } -void destroy() +G_MODULE_EXPORT void destroy() { lttv_option_remove("output"); @@ -246,6 +263,8 @@ void destroy() lttv_option_remove("process_state"); + g_string_free(a_string, TRUE); + lttv_hooks_remove_data(before_event, write_event_content, NULL); lttv_hooks_remove_data(before_trace, write_trace_header, NULL);