Add live trace support to LTTV GUI.
authorYannick Brosseau <yannick.brosseau@gmail.com>
Tue, 6 Dec 2011 17:13:40 +0000 (12:13 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 6 Dec 2011 17:13:40 +0000 (12:13 -0500)
Add an option to the open trace dialog to specify that the trace is to
be open in live mode
Update the displays when new events are available in a trace
Disable statistics for live traces

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttv/modules/gui/detailedevents/events.c
lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h
lttv/modules/gui/lttvwindow/lttvwindow/init_module.c
lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c
lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h
lttv/modules/gui/lttvwindow/lttvwindow/timeentry.h
lttv/modules/gui/statistics/statistics.c
lttv/modules/gui/tracecontrol/tracecontrol.c

index 0c1a153a935c03dff8c33390a01725f709b3b1fa..ae749eac9b1714807aebcc4dc08f8498c8dcdfb6 100644 (file)
@@ -99,6 +99,7 @@ gboolean update_current_time(void * hook_data, void * call_data);
 gboolean update_current_position(void * hook_data, void * call_data);
 //gboolean show_event_detail(void * hook_data, void * call_data);
 gboolean traceset_changed(void * hook_data, void * call_data);
+gboolean timespan_changed(void * hook_data, void * call_data);
 gboolean filter_changed(void * hook_data, void * call_data);
 
 static void request_background_data(EventViewerData *event_viewer_data);
@@ -211,6 +212,8 @@ gui_events(LttvPluginTab *ptab)
                 update_current_position,event_viewer_data);
   lttvwindow_register_traceset_notify(tab, 
                 traceset_changed,event_viewer_data);
+  lttvwindow_register_time_span_notify(tab, 
+                timespan_changed,event_viewer_data);
   lttvwindow_register_filter_notify(tab,
                 filter_changed, event_viewer_data);
   lttvwindow_register_redraw_notify(tab,
@@ -449,12 +452,14 @@ gui_events(LttvPluginTab *ptab)
   g_signal_connect (G_OBJECT (event_viewer_data->vadjust_c), "value-changed",
         G_CALLBACK (v_scroll_cb),
         event_viewer_data);
+  //TODO ybrosseau 2011-01-06: Fix comment
   /* Set the upper bound to the last event number */
   event_viewer_data->previous_value = 0;
   event_viewer_data->vadjust_c->lower = 0.0;
     //event_viewer_data->vadjust_c->upper = event_viewer_data->number_of_events;
   LttTime time = lttvwindow_get_current_time(tab);
   time = ltt_time_sub(time, tsc->time_span.start_time);
+  //TODO ybrosseau 2011-01-06: Which one do we keep?
   event_viewer_data->vadjust_c->value = ltt_time_to_double(time);
   event_viewer_data->vadjust_c->value = 0.0;
   event_viewer_data->vadjust_c->step_increment = 1.0;
@@ -1769,7 +1774,27 @@ gboolean update_current_position(void * hook_data, void * call_data)
   return FALSE;
 }
 
+gboolean timespan_changed(void * hook_data, void * call_data)
+{
+  EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
+  LttvTracesetContext * tsc =
+        lttvwindow_get_traceset_context(event_viewer_data->tab);
+  TimeInterval time_span = tsc->time_span;
+  LttTime end;
 
+  end = ltt_time_sub(time_span.end_time, time_span.start_time);
+  event_viewer_data->vadjust_c->upper = ltt_time_to_double(end);
+
+  if(event_viewer_data->pos->len < event_viewer_data->num_visible_events ) {
+
+         
+         get_events(event_viewer_data->vadjust_c->value, event_viewer_data);
+         
+         request_background_data(event_viewer_data);
+  }
+  return FALSE;
+}
 
 gboolean traceset_changed(void * hook_data, void * call_data)
 {
@@ -1863,6 +1888,8 @@ void gui_events_free(gpointer data)
     //                    show_event_detail, event_viewer_data);
     lttvwindow_unregister_traceset_notify(tab,
                         traceset_changed, event_viewer_data);
+    lttvwindow_unregister_time_span_notify(tab,
+                                   timespan_changed,event_viewer_data);
     lttvwindow_unregister_filter_notify(tab,
                         filter_changed, event_viewer_data);
     lttvwindow_unregister_redraw_notify(tab,
index d2e397f3b2df6598a3fbfbe234255ceae0c81ebf..310607d78af172e20f05f1b22466b4336ca4853b 100644 (file)
@@ -101,7 +101,6 @@ enum
 };
 
 
-
 #if 0
 static void on_top_notify(GObject    *gobject,
                GParamSpec *arg1,
@@ -303,71 +302,8 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset)
                                             new_time_window.time_width) ;
   }
 
-#if 0
-  /* Set scrollbar */
-  GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(tab->scrollbar));
-  LttTime upper = ltt_time_sub(time_span.end_time, time_span.start_time);
-      
-  g_object_set(G_OBJECT(adjustment),
-               "lower",
-                 0.0, /* lower */
-               "upper",
-               ltt_time_to_double(upper) 
-                 * NANOSECONDS_PER_SECOND, /* upper */
-               "step_increment",
-               ltt_time_to_double(tab->time_window.time_width)
-                             / SCROLL_STEP_PER_PAGE
-                             * NANOSECONDS_PER_SECOND, /* step increment */
-               "page_increment",
-               ltt_time_to_double(tab->time_window.time_width) 
-                 * NANOSECONDS_PER_SECOND, /* page increment */
-               "page_size",
-               ltt_time_to_double(tab->time_window.time_width) 
-                 * NANOSECONDS_PER_SECOND, /* page size */
-               NULL);
-  gtk_adjustment_changed(adjustment);
-
-  g_object_set(G_OBJECT(adjustment),
-               "value",
-               ltt_time_to_double(
-                ltt_time_sub(tab->time_window.start_time, time_span.start_time))
-                   * NANOSECONDS_PER_SECOND, /* value */
-               NULL);
-  gtk_adjustment_value_changed(adjustment);
-
-  /* set the time bar. The value callbacks will change their nsec themself */
-  /* start seconds */
-  gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry1),
-                            (double)time_span.start_time.tv_sec,
-                            (double)time_span.end_time.tv_sec);
-
-  /* end seconds */
-  gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry3),
-                            (double)time_span.start_time.tv_sec,
-                            (double)time_span.end_time.tv_sec);
-
-   /* current seconds */
-  gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry5),
-                            (double)time_span.start_time.tv_sec,
-                            (double)time_span.end_time.tv_sec);
-#endif //0
-  
   /* Finally, call the update hooks of the viewers */
-  LttvHooks * tmp;
-  LttvAttributeValue value;
-  gint retval = 0;
-  retval= lttv_iattribute_find_by_path(tab->attributes,
-    "hooks/updatetraceset", LTTV_POINTER, &value);
-  g_assert(retval);
-
-  tmp = (LttvHooks*)*(value.v_pointer);
-  if(tmp == NULL)
-         retval = 1;
-  else
-         lttv_hooks_call(tmp,traceset);
+  gint retval = update_traceset(tab,traceset);
 
   time_change_manager(tab, new_time_window);
   current_time_change_manager(tab, new_current_time);
@@ -408,20 +344,48 @@ int SetFilter(Tab * tab, gpointer filter)
  * @param tab viewer's tab 
  */
 
-void update_traceset(Tab *tab)
+int update_traceset(Tab *tab, LttvTraceset *traceset)
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
   gboolean retval;
 
   retval= lttv_iattribute_find_by_path(tab->attributes,
-    "hooks/updatetraceset", LTTV_POINTER, &value);
+                                 "hooks/updatetraceset", 
+                                 LTTV_POINTER, 
+                                 &value);
   g_assert(retval);
   tmp = (LttvHooks*)*(value.v_pointer);
-  if(tmp == NULL) return;
-  lttv_hooks_call(tmp, NULL);
+  if(tmp == NULL) {
+         retval = 1;
+  } else {
+         lttv_hooks_call(tmp, traceset);
+  }
+  return retval;
 }
 
+/** 
+    Call hooks register to get update on traceset time span changes
+*/
+int notify_time_span_changed(Tab *tab)
+{
+  LttvAttributeValue value;
+  LttvHooks * tmp;
+  gboolean retval;
+
+  retval= lttv_iattribute_find_by_path(tab->attributes,
+                                 "hooks/updatetimespan", 
+                                 LTTV_POINTER, 
+                                 &value);
+  g_assert(retval);
+  tmp = (LttvHooks*)*(value.v_pointer);
+  if(tmp == NULL) {
+         retval = 1;
+  } else {
+         lttv_hooks_call(tmp, NULL);
+  }
+  return retval;
+}
 
 /* get_label function is used to get user input, it displays an input
  * box, which allows user to input a string 
@@ -1506,7 +1470,49 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
 }
 
 #undef list_out
+/** 
+    Manage the periodic update of a live trace
+*/
+static gboolean
+live_trace_update_handler(Tab *tab)
+{  
+       unsigned int updated_count;
+
+       LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+       TimeInterval initial_time_span = tsc->time_span;
+       TimeInterval updated_time_span;
+
+       updated_count = lttv_process_traceset_update(tsc);
+       
+       /* TODO ybrosseau 2011-01-12: Add trace resynchronization  */
 
+       /* Get the changed period bounds */
+       updated_time_span = tsc->time_span;
+
+       if(ltt_time_compare(updated_time_span.start_time, 
+                               initial_time_span.start_time) != 0) {
+               /* The initial time should not change on a live update */
+               g_assert(FALSE);
+       }
+
+       /* Notify viewers (only on updates) */
+       if(ltt_time_compare(updated_time_span.end_time, 
+                               initial_time_span.end_time) != 0) {
+               
+               notify_time_span_changed(tab);
+               /* TODO ybrosseau 2011-01-12: Change the timebar to register 
+                  to the time_span hook */
+               timebar_set_minmax_time(TIMEBAR(tab->MTimebar),
+                                       &updated_time_span.start_time,
+                                       &updated_time_span.end_time );
+               
+               /* To update the min max */
+               time_change_manager(tab, tab->time_window);
+       }
+
+       /* Timer will be recalled as long as there is files to update */
+       return (updated_count > 0);
+}
 
 static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v)
 {
@@ -1561,6 +1567,16 @@ static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v)
 
   //FIXME
   //add_trace_into_traceset_selector(GTK_MULTIVPANED(tab->multivpaned), lttv_trace(trace_v));
+
+
+  if (lttv_trace(trace_v)->is_live) {
+         /* Add timer for live update */
+         /* TODO ybrosseau 2011-01-12: Parametrize the hardcoded 1 seconds */
+         g_timeout_add_seconds (1,
+                                (GSourceFunc) live_trace_update_handler,
+                                tab);
+  }
+
 }
 
 /* add_trace adds a trace into the current traceset. It first displays a 
@@ -1593,6 +1609,7 @@ void add_trace(GtkWidget * widget, gpointer user_data)
   }
 
   /* File open dialog management */
+  GtkWidget *extra_live_button; 
   GtkFileChooser * file_chooser = 
          GTK_FILE_CHOOSER(
                  gtk_file_chooser_dialog_new ("Select a trace",
@@ -1602,6 +1619,11 @@ void add_trace(GtkWidget * widget, gpointer user_data)
                                          GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
                                          NULL));
 
+  /* Button to indicate the opening of a live trace */
+  extra_live_button = gtk_check_button_new_with_mnemonic ("Trace is live (currently being writen)");
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extra_live_button), FALSE);
+  gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (file_chooser), extra_live_button);
+
   gtk_file_chooser_set_show_hidden (file_chooser, TRUE);
   if(remember_trace_dir[0] != '\0')
          gtk_file_chooser_set_filename(file_chooser, remember_trace_dir);
@@ -1612,6 +1634,7 @@ void add_trace(GtkWidget * widget, gpointer user_data)
     case GTK_RESPONSE_ACCEPT:
     case GTK_RESPONSE_OK:
       dir = gtk_file_chooser_get_filename (file_chooser);
+
       strncpy(remember_trace_dir, dir, PATH_MAX);
       strncat(remember_trace_dir, "/", PATH_MAX);
       if(!dir || strlen(dir) == 0){
@@ -1620,7 +1643,12 @@ void add_trace(GtkWidget * widget, gpointer user_data)
       get_absolute_pathname(dir, abs_path);
       trace_v = lttvwindowtraces_get_trace_by_name(abs_path);
       if(trace_v == NULL) {
-        trace = ltt_trace_open(abs_path);
+       if(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extra_live_button))) {
+         trace = ltt_trace_open_live(abs_path);
+       } else {
+         trace = ltt_trace_open(abs_path);
+       }
+         
         if(trace == NULL) {
           g_warning("cannot open trace %s", abs_path);
 
@@ -3295,7 +3323,6 @@ void current_position_change_manager(Tab *tab,
   set_current_position(tab, pos);
 }
 
-
 static void on_timebar_starttime_changed(Timebar *timebar,
                                gpointer user_data)
 {
@@ -4084,7 +4111,7 @@ gboolean execute_events_requests(Tab *tab)
 }
 
 
-__EXPORT void create_main_window_with_trace_list(GSList *traces)
+__EXPORT void create_main_window_with_trace_list(GSList *traces, gboolean is_live)
 {
   GSList *iter = NULL;
 
@@ -4116,7 +4143,11 @@ __EXPORT void create_main_window_with_trace_list(GSList *traces)
     get_absolute_pathname(path, abs_path);
     trace_v = lttvwindowtraces_get_trace_by_name(abs_path);
     if(trace_v == NULL) {
-      trace = ltt_trace_open(abs_path);
+      if(is_live) {
+       trace = ltt_trace_open_live(abs_path);
+      } else {
+       trace = ltt_trace_open(abs_path);
+      }
       if(trace == NULL) {
         g_warning("cannot open trace %s", abs_path);
 
index 1bbd4fbf05a5c13a0e8673f23a8b01884d238b67..b4373b80bff3537a94b11e87eacea8c00df1e994 100644 (file)
@@ -27,7 +27,7 @@ MainWindow *construct_main_window(MainWindow * parent);
 void main_window_free(MainWindow * mw);
 void main_window_destructor(MainWindow * mw);
 
-void create_main_window_with_trace_list(GSList *traces);
+void create_main_window_with_trace_list(GSList *traces, gboolean is_live);
 
 void insert_viewer_wrap(GtkWidget *menuitem, gpointer user_data);
 gboolean execute_events_requests(Tab *tab);
index 99ab15f73972158ad4d9ab6d34736a610ec8e46b..5b8289570066bb12da936fdae51a7a92495ccee7 100644 (file)
@@ -88,6 +88,7 @@ static GSList *g_init_trace = NULL;
 
 static char *a_trace;
 //static char g_init_trace[PATH_MAX] = "";
+static gboolean a_live;
 
 
 void lttv_trace_option(void *hook_data)
@@ -124,7 +125,7 @@ static gboolean window_creation_hook(void *hook_data, void *call_data)
   add_pixmap_directory ("../modules/gui/main/pixmaps");
 
   /* First window, use command line trace */
-  create_main_window_with_trace_list(g_init_trace);
+  create_main_window_with_trace_list(g_init_trace, a_live);
 
   gtk_main ();
 
@@ -174,6 +175,12 @@ static void init() {
       "pathname of the directory containing the trace", 
       LTTV_OPT_STRING, &a_trace, lttv_trace_option, NULL);
 
+  a_live = FALSE;
+  lttv_option_add("live", 0,
+      "define if the traceset is receiving live informations",
+      "",
+      LTTV_OPT_NONE, &a_live, NULL, NULL);
+
   retval= lttv_iattribute_find_by_path(attributes, "hooks/main/before",
     LTTV_POINTER, &value);
   g_assert(retval);
@@ -243,6 +250,7 @@ static void destroy_walk(gpointer data, gpointer user_data)
 static void destroy() {
 
   lttv_option_remove("trace");
+  lttv_option_remove("live");
 
   lttv_hooks_remove_data(main_hooks, window_creation_hook, NULL);
 
index ee3f9246063d47ce243fa6aa5a5a3c867158ed04..acb968bed7b3e3969f5701b8d23e282daa9d3857 100644 (file)
@@ -467,6 +467,53 @@ __EXPORT void lttvwindow_unregister_time_window_notify(Tab *tab,
   lttv_hooks_remove_data(tmp, hook, hook_data);
 }
 
+/**
+ * Function to register a hook function for a viewer to set/update its
+ * allowed time span.
+ * @param tab viewer's tab 
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ */
+__EXPORT void lttvwindow_register_time_span_notify(Tab *tab,
+    LttvHook hook, gpointer hook_data)
+{
+  LttvAttributeValue value;
+  LttvHooks * tmp;
+  gboolean retval;
+
+  retval= lttv_iattribute_find_by_path(tab->attributes,
+    "hooks/updatetimespan", LTTV_POINTER, &value);
+  g_assert(retval);
+  tmp = (LttvHooks*)*(value.v_pointer);
+  if(tmp == NULL){    
+    tmp = lttv_hooks_new();
+    *(value.v_pointer) = tmp;
+  }
+  lttv_hooks_add(tmp, hook,hook_data, LTTV_PRIO_DEFAULT);
+}
+/**
+ * Function to unregister a viewer's hook function which is used to 
+ * set/update the time span allowed for the viewer.
+ * @param tab viewer's tab 
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ */
+
+__EXPORT void lttvwindow_unregister_time_span_notify(Tab *tab,
+    LttvHook hook, gpointer hook_data)
+{
+  LttvAttributeValue value;
+  LttvHooks * tmp;
+  gboolean retval;
+
+  retval= lttv_iattribute_find_by_path(tab->attributes,
+    "hooks/updatetimespan", LTTV_POINTER, &value);
+  g_assert(retval);
+  tmp = (LttvHooks*)*(value.v_pointer);
+  if(tmp == NULL) return;
+  lttv_hooks_remove_data(tmp, hook, hook_data);
+}
+
 /**
  * Function to register a hook function for a viewer to set/update its 
  * traceset.
index 30fa5c6aabc7e1ac06a081a0ae98f26c44bc13c7..42a8ba3083087756470b5c3a12a2bf8909f0f667 100644 (file)
@@ -361,6 +361,36 @@ void lttvwindow_unregister_time_window_notify(Tab *tab,
                                               LttvHook    hook, 
                                               gpointer    hook_data);
 
+/**
+ * Function to register a hook function that will be called by the main window
+ * when the time span of the traceset is updated.
+ * 
+ * This register function is typically called by the constructor of the viewer.
+ * 
+ * @param tab the tab the viewer belongs to.
+ * @param hook hook that sould be called by the main window when the time
+ *             interval changes. 
+ * @param hook_data hook data associated with the hook function. It will
+ *                  be typically a pointer to the viewer's data structure.
+ */
+void lttvwindow_register_timespan_notify(Tab *tab,
+                                            LttvHook    hook,
+                                            gpointer    hook_data);
+
+/**
+ * Function to unregister the time_span notification hook.
+ * 
+ * This unregister function is typically called by the destructor of the viewer.
+ * 
+ * @param tab the tab the viewer belongs to.
+ * @param hook hook that sould be called by the main window when the time
+ *             interval changes. 
+ * @param hook_data hook data associated with the hook function. It will
+ *                  be typically a pointer to the viewer's data structure.
+ */
+void lttvwindow_unregister_timespan_notify(Tab *tab,
+                                            LttvHook    hook,
+                                            gpointer    hook_data);
 
 /**
  * Function to register a hook function that will be called by the main window
index 580b20c1ddbd633c6a5e04f336a828f23005396f..6dcf22b6e680de445e1c74bb9228ff8f4a441f34 100644 (file)
@@ -1,4 +1,3 @@
-
 /* This file is part of the Linux Trace Toolkit viewer
  * Copyright (C) 2010 Yannick Brosseau
  *
index 2b40d6be445a167fac8c2302e097eb9859b59280..ce7186299af8d49959282ed74addb7ea00171b0c 100644 (file)
@@ -116,6 +116,7 @@ struct _StatisticViewerData{
   GHashTable *statistic_hash;
 
   guint background_info_waiting;
+       guint live_trace_count;
 };
 
 
@@ -290,6 +291,7 @@ gui_statistic(LttvPluginTab *ptab)
   GtkTreeViewColumn *column;
 
   StatisticViewerData* statistic_viewer_data = g_new(StatisticViewerData,1);
+  statistic_viewer_data->live_trace_count = 0;
   Tab *tab = ptab->tab;
   statistic_viewer_data->tab  = tab;
   statistic_viewer_data->ptab  = ptab;
@@ -301,7 +303,6 @@ gui_statistic(LttvPluginTab *ptab)
   lttvwindow_register_traceset_notify(statistic_viewer_data->tab,
                                       statistic_traceset_changed,
                                       statistic_viewer_data);
   statistic_viewer_data->statistic_hash = g_hash_table_new_full(g_str_hash,
                                                   g_str_equal,
                                                   statistic_destroy_hash_key,
@@ -424,6 +425,8 @@ extern FILE *stdout;
 extern FILE *stderr;
 #endif //DEBUG
 
+static const char *live_msg = "Statistics for traceset containing live traces are inaccurate";
+
 void show_traceset_stats(StatisticViewerData * statistic_viewer_data)
 {
   Tab *tab = statistic_viewer_data->tab;
@@ -451,6 +454,21 @@ void show_traceset_stats(StatisticViewerData * statistic_viewer_data)
           -1);  
   path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
   str = gtk_tree_path_to_string (path);
+
+  for(i = 0 ; i < nb ; i++) {
+         if (LTTV_TRACESET_CONTEXT(tscs)->traces[i]->t->is_live) {
+                 statistic_viewer_data->live_trace_count++;
+         }
+
+  }
+  if (statistic_viewer_data->live_trace_count) {
+         LttvAttributeValue value;
+         value = lttv_attribute_add(tscs->stats,
+                                    g_quark_from_static_string("WARNING: Live traceset"),
+                                    LTTV_STRING);
+         *(value.v_string) = live_msg;
+         
+  }
   g_hash_table_insert(statistic_viewer_data->statistic_hash,
           (gpointer)str, tscs->stats);
   show_tree(statistic_viewer_data, tscs->stats, &iter);
@@ -467,16 +485,30 @@ void show_traceset_stats(StatisticViewerData * statistic_viewer_data)
             start_time.tv_nsec);
 #endif //0
     sprintf(trace_str, "%s", g_quark_to_string(ltt_trace_name(tcs->parent.parent.t)));
-    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);
-    str = gtk_tree_path_to_string (path);
-    g_hash_table_insert(statistic_viewer_data->statistic_hash,
-      (gpointer)str,tcs->stats);
-    show_tree(statistic_viewer_data, tcs->stats, &iter);
+    /* TODO ybrosseau 2011-01-12: Reenable stats for live trace */
+    if (LTTV_TRACE_CONTEXT(tcs)->t->is_live) {
+           strcat(trace_str, " [LIVE]");
+           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);
+           str = gtk_tree_path_to_string (path);
+           g_hash_table_insert(statistic_viewer_data->statistic_hash,
+                           (gpointer)str,0);
+           
+    } else {
+    
+           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);
+           str = gtk_tree_path_to_string (path);
+           g_hash_table_insert(statistic_viewer_data->statistic_hash,
+                           (gpointer)str,tcs->stats);
+           show_tree(statistic_viewer_data, tcs->stats, &iter);
 #ifdef DEBUG
-    lttv_attribute_write_xml(tcs->stats, stdout, 3, 4);
+           lttv_attribute_write_xml(tcs->stats, stdout, 3, 4);
 #endif //DEBUG
+    }
   }
 }
 
@@ -523,7 +555,7 @@ void show_tree(StatisticViewerData * statistic_viewer_data,
 void show_statistic(StatisticViewerData * statistic_viewer_data,
         LttvAttribute* stats, GtkTextBuffer* buf)
 {
-  int i, nb , flag;
+  int i, nb = 0, flag;
   LttvAttributeName name;
   LttvAttributeValue value;
   LttvAttributeType type;
@@ -532,7 +564,9 @@ void show_statistic(StatisticViewerData * statistic_viewer_data,
   GtkTextIter   text_iter;
   
   flag = 0;
-  nb = lttv_attribute_get_number(stats);
+  if(stats) {
+         nb = lttv_attribute_get_number(stats);
+  }
   for(i = 0 ; i < nb ; i++) {
     type = lttv_attribute_get(stats, i, &name, &value, &is_named);
                if(is_named)
index 56165d943a352d4997d254c3e3d81fd13c3dfd21..2aae7aaca7bdb1deee1ffc06a79aa1a3b9dee744 100644 (file)
@@ -1115,7 +1115,8 @@ void stop_clicked (GtkButton *button, gpointer user_data)
   switch(id){
     case GTK_RESPONSE_ACCEPT:
       {
-        create_main_window_with_trace_list(trace_list);
+              /* TODO ybrosseau: 2011-04-20: Add support for live trace */
+             create_main_window_with_trace_list(trace_list, FALSE);
       }
       break;
     case GTK_RESPONSE_REJECT:
This page took 0.035607 seconds and 4 git commands to generate.