From d730b5c8b76588740d11bd12c6e85ed26bebdb4e Mon Sep 17 00:00:00 2001 From: compudj Date: Sat, 27 Aug 2005 01:34:22 +0000 Subject: [PATCH] statistics working : still must add stats per time feature to graphical view git-svn-id: http://ltt.polymtl.ca/svn@1083 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/state.c | 3 -- ltt/branches/poly/lttv/lttv/stats.c | 37 ++++++++++++++++--- ltt/branches/poly/lttv/lttv/stats.h | 3 ++ .../lttv/modules/gui/statistics/statistics.c | 3 +- .../poly/lttv/modules/text/batchAnalysis.c | 3 +- .../poly/lttv/modules/text/textDump.c | 22 +++++++---- 6 files changed, 53 insertions(+), 18 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index 1fbb627e..8574778a 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -1446,7 +1446,6 @@ gint lttv_state_hook_remove_event_hooks(void *hook_data, void *call_data) return 0; } -static guint test_event_count = 0; void lttv_state_remove_event_hooks(LttvTracesetState *self) { LttvTraceset *traceset = self->parent.ts; @@ -1496,14 +1495,12 @@ void lttv_state_remove_event_hooks(LttvTracesetState *self) lttv_trace_hook_destroy(&g_array_index(hooks, LttvTraceHook, k)); g_array_free(hooks, TRUE); } - g_info("EVENT COUNT TEST : %u", test_event_count); } static gboolean state_save_event_hook(void *hook_data, void *call_data) { guint *event_count = (guint*)hook_data; - test_event_count++; /* Only save at LTTV_STATE_SAVE_INTERVAL */ if(likely((*event_count)++ < LTTV_STATE_SAVE_INTERVAL)) return FALSE; diff --git a/ltt/branches/poly/lttv/lttv/stats.c b/ltt/branches/poly/lttv/lttv/stats.c index 678978d7..bd9c1e6c 100644 --- a/ltt/branches/poly/lttv/lttv/stats.c +++ b/ltt/branches/poly/lttv/lttv/stats.c @@ -58,8 +58,8 @@ find_event_tree(LttvTracefileStats *tfcs, GQuark pid_time, GQuark cpu, GQuark mode, GQuark sub_mode, LttvAttribute **events_tree, LttvAttribute **event_types_tree); -static void -init(LttvTracesetStats *self, LttvTraceset *ts) + +static void lttv_stats_init(LttvTracesetStats *self) { guint i, j, nb_trace, nb_tracefile; @@ -80,8 +80,7 @@ init(LttvTracesetStats *self, LttvTraceset *ts) *stats_tree, *tracefiles_stats; - LTTV_TRACESET_CONTEXT_CLASS(g_type_class_peek(LTTV_TRACESET_STATE_TYPE))-> - init((LttvTracesetContext *)self, ts); + LttvTraceset *ts = self->parent.parent.ts; self->stats = lttv_attribute_find_subdir( lttv_traceset_attribute(self->parent.parent.ts), @@ -127,10 +126,10 @@ init(LttvTracesetStats *self, LttvTraceset *ts) &tfcs->current_event_types_tree); } } + } -static void -fini(LttvTracesetStats *self) +static void lttv_stats_fini(LttvTracesetStats *self) { guint i, j, nb_trace, nb_tracefile; @@ -189,6 +188,32 @@ fini(LttvTracesetStats *self) tfcs->current_event_types_tree = NULL; } } +} + + +void lttv_stats_reset(LttvTracesetStats *self) +{ + lttv_stats_fini(self); + lttv_stats_init(self); +} + + + +static void +init(LttvTracesetStats *self, LttvTraceset *ts) +{ + LTTV_TRACESET_CONTEXT_CLASS(g_type_class_peek(LTTV_TRACESET_STATE_TYPE))-> + init((LttvTracesetContext *)self, ts); + + lttv_stats_init(self); +} + + +static void +fini(LttvTracesetStats *self) +{ + lttv_stats_fini(self); + LTTV_TRACESET_CONTEXT_CLASS(g_type_class_peek(LTTV_TRACESET_STATE_TYPE))-> fini((LttvTracesetContext *)self); } diff --git a/ltt/branches/poly/lttv/lttv/stats.h b/ltt/branches/poly/lttv/lttv/stats.h index aba1a68b..090cbe5e 100644 --- a/ltt/branches/poly/lttv/lttv/stats.h +++ b/ltt/branches/poly/lttv/lttv/stats.h @@ -165,6 +165,9 @@ void lttv_stats_sum_traceset(LttvTracesetStats *self); void lttv_stats_sum_trace(LttvTraceStats *self); +/* Reset all statistics containers */ +void lttv_stats_reset(LttvTracesetStats *self); + /* The LttvTracesetStats, LttvTraceStats and LttvTracefileStats types inherit from the corresponding State objects defined in state.h.. */ diff --git a/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c b/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c index 075997f9..99e78341 100644 --- a/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c +++ b/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c @@ -438,13 +438,14 @@ void show_traceset_stats(StatisticViewerData * statistic_viewer_data) //show stats for all traces for(i = 0 ; i < nb ; i++) { tcs = (LttvTraceStats *)(LTTV_TRACESET_CONTEXT(tscs)->traces[i]); +#if 0 //FIXME desc = ltt_trace_system_description(tcs->parent.parent.t); LttTime start_time = ltt_trace_system_description_trace_start_time(desc); sprintf(trace_str, "Trace on system %s at time %lu.%09lu", ltt_trace_system_description_node_name(desc), start_time.tv_sec, start_time.tv_nsec); - +#endif //0 gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_set (store, &iter,NAME_COLUMN,trace_str,-1); path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); diff --git a/ltt/branches/poly/lttv/modules/text/batchAnalysis.c b/ltt/branches/poly/lttv/modules/text/batchAnalysis.c index ebb2248f..80f11d3c 100644 --- a/ltt/branches/poly/lttv/modules/text/batchAnalysis.c +++ b/ltt/branches/poly/lttv/modules/text/batchAnalysis.c @@ -117,7 +117,6 @@ static gboolean process_traceset(void *hook_data, void *call_data) G_MAXULONG, NULL); - g_info("BatchAnalysis destroy context"); //lttv_traceset_context_remove_hooks(tc, //before_traceset, after_traceset, NULL, before_trace, after_trace, @@ -129,6 +128,8 @@ static gboolean process_traceset(void *hook_data, void *call_data) event_hook, NULL); + g_info("BatchAnalysis destroy context"); + lttv_filter_destroy(*(value_filter.v_pointer)); lttv_state_remove_event_hooks(&tscs->parent); if(a_stats) lttv_stats_remove_event_hooks(tscs); diff --git a/ltt/branches/poly/lttv/modules/text/textDump.c b/ltt/branches/poly/lttv/modules/text/textDump.c index 32259a6b..14ea876f 100644 --- a/ltt/branches/poly/lttv/modules/text/textDump.c +++ b/ltt/branches/poly/lttv/modules/text/textDump.c @@ -154,6 +154,10 @@ void lttv_event_to_string(LttEvent *e, GString *s, LttTime time; + guint cpu = ltt_tracefile_num(tfs->parent.tf); + LttvTraceState *ts = (LttvTraceState*)tfs->parent.t_context; + LttvProcessState *process = ts->running_process[cpu]; + g_string_set_size(s,0); facility = ltt_event_facility(e); @@ -166,11 +170,11 @@ void lttv_event_to_string(LttEvent *e, GString *s, 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(tfs->cpu_name)); + g_quark_to_string(ltt_tracefile_name(tfs->parent.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)); + g_string_append_printf(s,", %u, %u, %s", process->pid, + process->ppid, + g_quark_to_string(process->state->t)); } if(field) @@ -357,8 +361,11 @@ static int write_event_content(void *hook_data, void *call_data) LttvFilter *filter; - e = ltt_tracefile_get_event(tfc->tf); + guint cpu = ltt_tracefile_num(tfs->parent.tf); + LttvTraceState *ts = (LttvTraceState*)tfc->t_context; + LttvProcessState *process = ts->running_process[cpu]; + e = ltt_tracefile_get_event(tfc->tf); g_assert(lttv_iattribute_find_by_path(attributes, "filter/lttv_filter", LTTV_POINTER, &value_filter)); @@ -368,7 +375,8 @@ static int write_event_content(void *hook_data, void *call_data) * call to the filter if available */ if(filter->head != NULL) - if(!lttv_filter_tree_parse(filter->head,e,tfc->tf,tfc->t_context->t,tfs->process,tfc)) + if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,process,tfc)) return FALSE; lttv_event_to_string(e, a_string, TRUE, a_field_names, tfs); @@ -376,7 +384,7 @@ static int write_event_content(void *hook_data, void *call_data) if(a_state) { g_string_append_printf(a_string, " %s ", - g_quark_to_string(tfs->process->state->s)); + g_quark_to_string(process->state->s)); } fputs(a_string->str, a_file); -- 2.34.1