Added options to run different tests in module batchtest
[lttv.git] / ltt / branches / poly / lttv / modules / gui / statistics / statistics.c
index 7541336de51bdbd6fff5f08987d0dfcead20e24a..9bd4b8d6f1ded28fbd42554e3f7d51010aca6e70 100644 (file)
@@ -21,8 +21,9 @@
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 
+#include <lttv/lttv.h>
 #include <lttv/module.h>
-#include <lttv/gtkTraceSet.h>
+#include <lttv/gtktraceset.h>
 #include <lttv/processTrace.h>
 #include <lttv/hook.h>
 #include <lttv/common.h>
 
 #include "../icons/hGuiStatisticInsert.xpm"
 
-#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
-#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
-
-#define PATH_LENGTH        256
+#define PATH_LENGTH        256  /* CHECK */
 
 static LttvModule *statistic_main_win_module;
 static GPtrArray  * statistic_traceset;
@@ -191,6 +189,7 @@ gui_statistic_destructor(StatisticViewerData *statistic_viewer_data)
 {
   /* May already been done by GTK window closing */
   if(GTK_IS_WIDGET(statistic_viewer_data->hpaned_v)){
+    gui_statistic_free(statistic_viewer_data);
     gtk_widget_destroy(statistic_viewer_data->hpaned_v);
     statistic_viewer_data = NULL;
   }
@@ -424,6 +423,10 @@ void show_traceset_stats(StatisticViewerData * statistic_viewer_data)
 
   if(tscs->stats == NULL) return;
 
+  ts = tscs->parent.parent.ts;
+  nb = lttv_traceset_number(ts);
+  if(nb == 0)return;
+
   gtk_tree_store_append (store, &iter, NULL);  
   gtk_tree_store_set (store, &iter,
           NAME_COLUMN, "Traceset statistics",
@@ -435,9 +438,6 @@ void show_traceset_stats(StatisticViewerData * statistic_viewer_data)
   show_tree(statistic_viewer_data, tscs->stats, &iter);
 
   //show stats for all traces
-  ts = tscs->parent.parent.ts;
-  nb = lttv_traceset_number(ts);
-  
   for(i = 0 ; i < nb ; i++) {
     tcs = (LttvTraceStats *)(LTTV_TRACESET_CONTEXT(tscs)->traces[i]);
     desc = ltt_trace_system_description(tcs->parent.parent.t);    
@@ -593,8 +593,8 @@ gboolean statistic_traceset_changed(void * hook_data, void * call_data)
 {
   StatisticViewerData *statistic_viewer_data = (StatisticViewerData*) hook_data;
   
-  //  gtk_tree_store_clear (statistic_viewer_data->store_m);  
-  //  statistic_viewer_data->shown = FALSE;
+  gtk_tree_store_clear (statistic_viewer_data->store_m);  
+  statistic_viewer_data->shown = FALSE;
 
   return FALSE;
 }
@@ -602,7 +602,7 @@ gboolean statistic_traceset_changed(void * hook_data, void * call_data)
 void statistic_add_context_hooks(StatisticViewerData * statistic_viewer_data, 
            LttvTracesetContext * tsc)
 {
-  gint i, j, nbi, nb_tracefile, nb_control, nb_per_cpu;
+  gint i, j, nbi, nb_tracefile;
   LttTrace *trace;
   LttvTraceContext *tc;
   LttvTracefileContext *tfc;
@@ -625,19 +625,14 @@ void statistic_add_context_hooks(StatisticViewerData * statistic_viewer_data,
     trace = tc->t;
     //if there are hooks for trace, add them here
 
-    nb_control = ltt_trace_control_tracefile_number(trace);
-    nb_per_cpu = ltt_trace_per_cpu_tracefile_number(trace);
-    nb_tracefile = nb_control + nb_per_cpu;
+    nb_tracefile = ltt_trace_control_tracefile_number(trace) +
+        ltt_trace_per_cpu_tracefile_number(trace);
     
     for(j = 0 ; j < nb_tracefile ; j++) {
       tf_s = lttv_trace_selector_tracefile_get(t_s,j);
       selected = lttv_tracefile_selector_get_selected(tf_s);
       if(!selected) continue;
-      
-      if(j < nb_control)
-  tfc = tc->control_tracefiles[j];
-      else
-  tfc = tc->per_cpu_tracefiles[j - nb_control];
+      tfc = tc->tracefiles[j];
       
       //if there are hooks for tracefile, add them here
       //      lttv_tracefile_context_add_hooks(tfc, NULL,NULL,NULL,NULL,
@@ -654,7 +649,7 @@ void statistic_add_context_hooks(StatisticViewerData * statistic_viewer_data,
 void statistic_remove_context_hooks(StatisticViewerData * statistic_viewer_data, 
         LttvTracesetContext * tsc)
 {
-  gint i, j, nbi, nb_tracefile, nb_control, nb_per_cpu;
+  gint i, j, nbi, nb_tracefile;
   LttTrace *trace;
   LttvTraceContext *tc;
   LttvTracefileContext *tfc;
@@ -677,19 +672,14 @@ void statistic_remove_context_hooks(StatisticViewerData * statistic_viewer_data,
     trace = tc->t;
     //if there are hooks for trace, remove them here
 
-    nb_control = ltt_trace_control_tracefile_number(trace);
-    nb_per_cpu = ltt_trace_per_cpu_tracefile_number(trace);
-    nb_tracefile = nb_control + nb_per_cpu;
+    nb_tracefile = ltt_trace_control_tracefile_number(trace) +
+        ltt_trace_per_cpu_tracefile_number(trace);
     
     for(j = 0 ; j < nb_tracefile ; j++) {
       tf_s = lttv_trace_selector_tracefile_get(t_s,j);
       selected = lttv_tracefile_selector_get_selected(tf_s);
       if(!selected) continue;
-      
-      if(j < nb_control)
-  tfc = tc->control_tracefiles[j];
-      else
-  tfc = tc->per_cpu_tracefiles[j - nb_control];
+      tfc = tc->tracefiles[j];
       
       //if there are hooks for tracefile, remove them here
       //      lttv_tracefile_context_remove_hooks(tfc, NULL,NULL,NULL,NULL,
This page took 0.025572 seconds and 4 git commands to generate.