statistics working : still must add stats per time feature to graphical view
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 27 Aug 2005 01:34:22 +0000 (01:34 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 27 Aug 2005 01:34:22 +0000 (01:34 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1083 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/state.c
ltt/branches/poly/lttv/lttv/stats.c
ltt/branches/poly/lttv/lttv/stats.h
ltt/branches/poly/lttv/modules/gui/statistics/statistics.c
ltt/branches/poly/lttv/modules/text/batchAnalysis.c
ltt/branches/poly/lttv/modules/text/textDump.c

index 1fbb627eab96aed27b20a6579934226b9708b4e6..8574778a9843d8ecf96fa49427cbff6407da2499 100644 (file)
@@ -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;
index 678978d7fca773309dd956d40b839a34e9ef0409..bd9c1e6cab27d735bb8ef7e3806ec77ae21857ec 100644 (file)
@@ -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);
 }
index aba1a68b2c24b5f7e5be9a6c3841fe189df661af..090cbe5e2461b91c35420162524ef8a5f8cf3885 100644 (file)
@@ -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.. */
index 075997f9585f32b9fce8bad64145b61df418c280..99e7834120c420a7ec623d7f7bb10ea6937b2b38 100644 (file)
@@ -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);
index ebb2248f8211d4ec9bb39bba5daccc82444bdaa6..80f11d3c361de18af0114c9cf1d54aca5e13031d 100644 (file)
@@ -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);
index 32259a6bb275fd71f2638e984dee395ba60c64a2..14ea876f91ff0ad7b38e3cbc0bf9d53f3166421b 100644 (file)
@@ -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);
This page took 0.031228 seconds and 4 git commands to generate.