#include <lttv/print.h>
#include <ltt/ltt.h>
#include <ltt/event.h>
-#include <ltt/type.h>
#include <ltt/trace.h>
-#include <ltt/facility.h>
#include <stdio.h>
static gboolean
- a_field_names,
+ a_no_field_names,
a_state,
a_cpu_stats,
a_process_stats,
fprintf(a_file,"End trace set\n\n");
if(LTTV_IS_TRACESET_STATS(tc)) {
- lttv_stats_sum_traceset((LttvTracesetStats *)tc);
+ lttv_stats_sum_traceset((LttvTracesetStats *)tc, ltt_time_infinite);
print_stats(a_file, (LttvTracesetStats *)tc);
}
static int write_event_content(void *hook_data, void *call_data)
{
+ gboolean result;
+
LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes());
LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
e = ltt_tracefile_get_event(tfc->tf);
- g_assert(lttv_iattribute_find_by_path(attributes, "filter/lttv_filter",
- LTTV_POINTER, &value_filter));
+ result = lttv_iattribute_find_by_path(attributes, "filter/lttv_filter",
+ LTTV_POINTER, &value_filter);
+ g_assert(result);
filter = (LttvFilter*)*(value_filter.v_pointer);
/*
*/
if(filter->head != NULL)
if(!lttv_filter_tree_parse(filter->head,e,tfc->tf,
- tfc->t_context->t,tfc))
+ tfc->t_context->t,tfc,NULL,NULL))
return FALSE;
- lttv_event_to_string(e, a_string, TRUE, a_field_names, tfs);
- g_string_append_printf(a_string,"\n");
+ lttv_event_to_string(e, a_string, TRUE, !a_no_field_names, tfs);
if(a_state) {
g_string_append_printf(a_string, " %s ",
g_quark_to_string(process->state->s));
}
+ g_string_append_printf(a_string,"\n");
+
fputs(a_string->str, a_file);
return FALSE;
}
static void init()
{
+ gboolean result;
+
LttvAttributeValue value;
LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes());
"file name",
LTTV_OPT_STRING, &a_file_name, NULL, NULL);
- a_field_names = FALSE;
- lttv_option_add("field_names", 'l',
- "write the field names for each event",
+ a_no_field_names = FALSE;
+ lttv_option_add("field_names", 's',
+ "do not write the field names for each event",
"",
- LTTV_OPT_NONE, &a_field_names, NULL, NULL);
+ LTTV_OPT_NONE, &a_no_field_names, NULL, NULL);
a_state = FALSE;
- lttv_option_add("process_state", 's',
+ lttv_option_add("process_state", 'r',
"write the pid and state for each event",
"",
LTTV_OPT_NONE, &a_state, NULL, NULL);
"",
LTTV_OPT_NONE, &a_path_output, NULL, NULL);
- g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event",
- LTTV_POINTER, &value));
- g_assert((event_hook = *(value.v_pointer)) != NULL);
+ result = lttv_iattribute_find_by_path(attributes, "hooks/event",
+ LTTV_POINTER, &value);
+ g_assert(result);
+ event_hook = *(value.v_pointer);
+ g_assert(event_hook);
lttv_hooks_add(event_hook, write_event_content, NULL, LTTV_PRIO_DEFAULT);
- g_assert(lttv_iattribute_find_by_path(attributes, "hooks/trace/before",
- LTTV_POINTER, &value));
- g_assert((before_trace = *(value.v_pointer)) != NULL);
+ result = lttv_iattribute_find_by_path(attributes, "hooks/trace/before",
+ LTTV_POINTER, &value);
+ g_assert(result);
+ before_trace = *(value.v_pointer);
+ g_assert(before_trace);
lttv_hooks_add(before_trace, write_trace_header, NULL, LTTV_PRIO_DEFAULT);
- g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/before",
- LTTV_POINTER, &value));
- g_assert((before_traceset = *(value.v_pointer)) != NULL);
+ result = lttv_iattribute_find_by_path(attributes, "hooks/traceset/before",
+ LTTV_POINTER, &value);
+ g_assert(result);
+ before_traceset = *(value.v_pointer);
+ g_assert(before_traceset);
lttv_hooks_add(before_traceset, write_traceset_header, NULL,
LTTV_PRIO_DEFAULT);
- g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/after",
- LTTV_POINTER, &value));
- g_assert((after_traceset = *(value.v_pointer)) != NULL);
+ result = lttv_iattribute_find_by_path(attributes, "hooks/traceset/after",
+ LTTV_POINTER, &value);
+ g_assert(result);
+ after_traceset = *(value.v_pointer);
+ g_assert(after_traceset);
lttv_hooks_add(after_traceset, write_traceset_footer, NULL,
LTTV_PRIO_DEFAULT);
}
lttv_hooks_remove_data(before_trace, write_trace_header, NULL);
- lttv_hooks_remove_data(before_trace, write_traceset_header, NULL);
+ lttv_hooks_remove_data(before_traceset, write_traceset_header, NULL);
- lttv_hooks_remove_data(before_trace, write_traceset_footer, NULL);
+ lttv_hooks_remove_data(after_traceset, write_traceset_footer, NULL);
}