filter working: for selecting trace/tracefile
authoryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 24 Nov 2003 20:07:28 +0000 (20:07 +0000)
committeryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 24 Nov 2003 20:07:28 +0000 (20:07 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@338 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/include/lttv/gtkTraceSet.h
ltt/branches/poly/include/lttv/processTrace.h
ltt/branches/poly/ltt/tracefile.c
ltt/branches/poly/lttv/modules/gui/API/gtkTraceSet.c
ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.c
ltt/branches/poly/lttv/modules/guiEvents.c
ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c
ltt/branches/poly/lttv/processTrace.c

index 2d7ed4dcf6c2ad225ecb1550546852c27633f330..2672f1376f7a90314e08149127c64b7103a8535e 100644 (file)
@@ -189,6 +189,14 @@ void unreg_update_traceset(LttvHook hook, gpointer hook_data,
                         MainWindow * main_win);
 
 
+/**
+ * Function to redraw each viewer belonging to the current tab 
+ * @param main_win the main window the viewer belongs to.
+ */
+
+void update_traceset(MainWindow * main_win);
+
+
 /**
  * Function to register a hook function for a viewer to set/update its 
  * filter.
@@ -414,3 +422,5 @@ void stats_remove_event_hooks_api(MainWindow *main_win );
  */
 
 LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win);
+
+LttvTracesetContext* get_traceset_context(MainWindow *main_win);
index e8505b5d8ba25bf0ca34909e207a250ece8148e7..aa1b6ae37dc26309075199c81c8c721c87d9ecd8 100644 (file)
@@ -196,6 +196,40 @@ void lttv_traceset_context_remove_hooks(LttvTracesetContext *self,
     LttvHooks *before_event, 
     LttvHooks *after_event);
 
+void lttv_trace_context_add_hooks(LttvTraceContext *self,
+                                 LttvHooks *check_trace, 
+                                 LttvHooks *before_trace, 
+                                 LttvHooks *after_trace);
+
+void lttv_trace_context_remove_hooks(LttvTraceContext *self,
+                                    LttvHooks *check_trace, 
+                                    LttvHooks *before_trace, 
+                                    LttvHooks *after_trace);
+
+void lttv_tracefile_context_add_hooks(LttvTracefileContext *self,
+                                     LttvHooks *check_tracefile,
+                                     LttvHooks *before_tracefile,
+                                     LttvHooks *after_tracefile,
+                                     LttvHooks *check_event, 
+                                     LttvHooks *before_event, 
+                                     LttvHooks *after_event);
+
+void lttv_tracefile_context_remove_hooks(LttvTracefileContext *self,
+                                        LttvHooks *check_tracefile,
+                                        LttvHooks *before_tracefile,
+                                        LttvHooks *after_tracefile,
+                                        LttvHooks *check_event, 
+                                        LttvHooks *before_event, 
+                                        LttvHooks *after_event);
+
+void lttv_tracefile_context_add_hooks_by_id(LttvTracefileContext *self,
+                                           unsigned i,
+                                           LttvHooks *before_event_by_id, 
+                                           LttvHooks *after_event_by_id);
+
+void lttv_tracefile_context_remove_hooks_by_id(LttvTracefileContext *self,
+                                              unsigned i);
+
 typedef struct _LttvTraceHook {
   LttvHook h;
   guint id;
index debf0327eb40bdc235b69963afb317cd26f2752f..97ac57cc35f260c6c27af23e15d217f56725524e 100644 (file)
@@ -871,7 +871,8 @@ void ltt_tracefile_seek_time(LttTracefile *t, LttTime time)
       ltt_tracefile_find_time_block(t, time, t->which_block+1, t->block_number);
       return ltt_tracefile_seek_time(t, time);
     }else {
-      g_print("End of file\n");      
+     t->cur_event_pos = t->buffer + t->block_size;
+     g_print("End of file\n");      
       return;      
     }    
   }else if(tailTime == 0){
index b079fb5a39e998c800b0724c0f7624196b862476..ec71b69d678705a6d213c0eaab290e25d5ed5fac 100644 (file)
@@ -361,7 +361,7 @@ void reg_update_traceset(LttvHook hook, gpointer hook_data,
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->attributes,
+  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
                       "hooks/updatetraceset", LTTV_POINTER, &value));
   tmp = (LttvHooks*)*(value.v_pointer);
   if(tmp == NULL){    
@@ -386,7 +386,7 @@ void unreg_update_traceset(LttvHook hook, gpointer hook_data,
 {
   LttvAttributeValue value;
   LttvHooks * tmp;
-  g_assert(lttv_iattribute_find_by_path(main_win->attributes,
+  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
                       "hooks/updatetraceset", LTTV_POINTER, &value));
   tmp = (LttvHooks*)*(value.v_pointer);
   if(tmp == NULL) return;
@@ -394,6 +394,23 @@ void unreg_update_traceset(LttvHook hook, gpointer hook_data,
 }
 
 
+/**
+ * Function to redraw each viewer belonging to the current tab 
+ * @param main_win the main window the viewer belongs to.
+ */
+
+void update_traceset(MainWindow * main_win)
+{
+  LttvAttributeValue value;
+  LttvHooks * tmp;
+  g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
+                      "hooks/updatetraceset", LTTV_POINTER, &value));
+  tmp = (LttvHooks*)*(value.v_pointer);
+  if(tmp == NULL) return;
+  lttv_hooks_call(tmp, NULL);
+}
+
+
 /**
  * Function to register a hook function for a viewer to set/update its 
  * filter.
@@ -756,3 +773,9 @@ LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win)
 {
   return main_win->current_tab->traceset_info->traceset_context;
 }
+
+
+LttvTracesetContext* get_traceset_context(MainWindow *main_win)
+{
+  return (LttvTracesetContext*)main_win->current_tab->traceset_info->traceset_context;
+}
index 5fa2a787dff3d6f87cd1d53a51d6b154daf206bb..9a62b515c331c19c982e32bf83518e3c9a9584fb 100644 (file)
@@ -33,7 +33,7 @@ MainWindow * get_window_data_struct(GtkWidget * widget);
 char * get_unload_module(char ** loaded_module_name, int nb_module);
 char * get_remove_trace(char ** all_trace_name, int nb_trace);
 char * get_selection(char ** all_name, int nb, char *title, char * column_title);
-void get_filter_selection(LttvTracesetSelector *s, char *title, char * column_title);
+gboolean get_filter_selection(LttvTracesetSelector *s, char *title, char * column_title);
 void * create_tab(MainWindow * parent, MainWindow * current_window,
                  GtkNotebook * notebook, char * label);
 
@@ -49,8 +49,8 @@ void add_trace_into_traceset_selector(GtkMultiVPaned * paned, LttTrace * trace);
 
 LttvTracesetSelector * construct_traceset_selector(LttvTraceset * traceset);
 
-void redraw_viewer(MainWindow * mw_data, TimeWindow * time_window, unsigned nb_events);
-
+void redraw_viewer(MainWindow * mw_data, TimeWindow * time_window);
+unsigned get_max_event_number(MainWindow * mw_data);
 
 enum {
   CHECKBOX_COLUMN,
@@ -101,25 +101,10 @@ LttvTracesetSelector * construct_traceset_selector(LttvTraceset * traceset)
 void
 insert_viewer_wrap(GtkWidget *menuitem, gpointer user_data)
 {
-  GdkWindow * win;
-  GdkCursor * new;
   guint val = 20;
-  GtkWidget* widget = menuitem;
 
-  new = gdk_cursor_new(GDK_X_CURSOR);
-  if(GTK_IS_MENU_ITEM(menuitem)){
-    widget = lookup_widget(menuitem, "MToolbar2");
-  }
-  win = gtk_widget_get_parent_window(widget);  
-  gdk_window_set_cursor(win, new);
-  gdk_cursor_unref(new);  
-  gdk_window_stick(win);
-  gdk_window_unstick(win);
   insert_viewer((GtkWidget*)menuitem, (view_constructor)user_data);
   //  selected_hook(&val);
-
-  gdk_window_set_cursor(win, NULL);  
 }
 
 
@@ -130,7 +115,6 @@ void insert_viewer(GtkWidget* widget, view_constructor constructor)
   MainWindow * mw_data;  
   GtkWidget * viewer;
   LttvTracesetSelector  * s;
-  unsigned * size;
   TimeInterval * time_interval;
   TimeWindow  time_window;
 
@@ -146,9 +130,6 @@ void insert_viewer(GtkWidget* widget, view_constructor constructor)
     // Added by MD
     //    g_object_unref(G_OBJECT(viewer));
 
-    size = (unsigned*)g_object_get_data(G_OBJECT(viewer), MAX_NUMBER_EVENT);
-    if(size == NULL) *size = G_MAXULONG;
-
     time_window = mw_data->current_tab->time_window;
     time_interval = (TimeInterval*)g_object_get_data(G_OBJECT(viewer), TRACESET_TIME_SPAN);
     if(time_interval){
@@ -156,7 +137,7 @@ void insert_viewer(GtkWidget* widget, view_constructor constructor)
       time_window.time_width = ltt_time_sub(time_interval->endTime,time_interval->startTime);
     }
 
-    redraw_viewer(mw_data,&time_window, *size);
+    redraw_viewer(mw_data,&time_window);
     set_current_time(mw_data,&(mw_data->current_tab->current_time));
   }
 }
@@ -285,17 +266,54 @@ void open_traceset(GtkWidget * widget, gpointer user_data)
 
 }
 
-void redraw_viewer(MainWindow * mw_data, TimeWindow * time_window, unsigned nb_events)
+unsigned get_max_event_number(MainWindow * mw_data)
 {
+  unsigned nb = 0, *size;
+  GtkWidget * w;
+
+  w = gtk_multi_vpaned_get_first_widget(mw_data->current_tab->multi_vpaned);  
+  while(w){
+    size = (unsigned*)g_object_get_data(G_OBJECT(w), MAX_NUMBER_EVENT);
+    if(size == NULL){
+      nb = G_MAXULONG;
+      break;
+    }else{
+      if(nb < *size)
+       nb = *size;
+    }
+    w = gtk_multi_vpaned_get_next_widget(mw_data->current_tab->multi_vpaned);  
+  }  
+  return nb;
+}
+
+void redraw_viewer(MainWindow * mw_data, TimeWindow * time_window)
+{
+  unsigned max_nb_events;
+  GdkWindow * win;
+  GdkCursor * new;
+  GtkWidget* widget;
+
+  new = gdk_cursor_new(GDK_X_CURSOR);
+  widget = lookup_widget(mw_data->mwindow, "MToolbar2");
+  win = gtk_widget_get_parent_window(widget);  
+  gdk_window_set_cursor(win, new);
+  gdk_cursor_unref(new);  
+  gdk_window_stick(win);
+  gdk_window_unstick(win);
   //update time window of each viewer, let viewer insert hooks needed by process_traceset
   set_time_window(mw_data, time_window);
+  
+  max_nb_events = get_max_event_number(mw_data);
 
   process_traceset_api(mw_data, time_window->start_time, 
                       ltt_time_add(time_window->start_time,time_window->time_width),
-                      nb_events);
+                      max_nb_events);
 
   //call hooks to show each viewer and let them remove hooks
   show_viewer(mw_data);  
+
+  gdk_window_set_cursor(win, NULL);  
 }
 
 void add_trace_into_traceset_selector(GtkMultiVPaned * paned, LttTrace * t)
@@ -366,7 +384,8 @@ void add_trace(GtkWidget * widget, gpointer user_data)
       gtk_widget_destroy((GtkWidget*)file_selector);
       
       //update current tab
-      redraw_viewer(mw_data, &(mw_data->current_tab->time_window), G_MAXULONG);
+      update_traceset(mw_data);
+      redraw_viewer(mw_data, &(mw_data->current_tab->time_window));
       set_current_time(mw_data,&(mw_data->current_tab->current_time));
       break;
     case GTK_RESPONSE_REJECT:
@@ -458,7 +477,8 @@ void remove_trace(GtkWidget * widget, gpointer user_data)
                            LTTV_TRACESET_CONTEXT(mw_data->current_tab->
                                      traceset_info->traceset_context),traceset);      
          //update current tab
-         redraw_viewer(mw_data, &(mw_data->current_tab->time_window), G_MAXULONG);
+         update_traceset(mw_data);
+         redraw_viewer(mw_data, &(mw_data->current_tab->time_window));
          set_current_time(mw_data,&(mw_data->current_tab->current_time));
        }
        break;
@@ -483,7 +503,7 @@ void zoom(GtkWidget * widget, double size)
 {
   TimeInterval *time_span;
   TimeWindow time_window;
-  LttTime    current_time, time_delta, time_s, time_e;
+  LttTime    current_time, time_delta, time_s, time_e, time_t;
   MainWindow * mw_data = get_window_data_struct(widget);
 
   time_span = LTTV_TRACESET_CONTEXT(mw_data->current_tab->
@@ -500,8 +520,13 @@ void zoom(GtkWidget * widget, double size)
     if(ltt_time_compare(time_window.time_width,time_delta) > 0)
       time_window.time_width = time_delta;        
 
-    time_s = ltt_time_sub(current_time,ltt_time_div(time_window.time_width, 2));
-    time_e = ltt_time_add(current_time,ltt_time_div(time_window.time_width, 2));
+    time_t = ltt_time_div(time_window.time_width, 2);
+    if(ltt_time_compare(current_time, time_t) < 0){
+      time_s = time_span->startTime;
+    } else {
+      time_s = ltt_time_sub(current_time,time_t);
+    }
+    time_e = ltt_time_add(current_time,time_t);
     if(ltt_time_compare(time_span->startTime, time_s) > 0){
       time_s = time_span->startTime;
     }else if(ltt_time_compare(time_span->endTime, time_e) < 0){
@@ -510,7 +535,7 @@ void zoom(GtkWidget * widget, double size)
     }
     time_window.start_time = time_s;    
   }
-  redraw_viewer(mw_data, &time_window, G_MAXULONG);
+  redraw_viewer(mw_data, &time_window);
   set_current_time(mw_data,&(mw_data->current_tab->current_time));
   gtk_multi_vpaned_set_adjust(mw_data->current_tab->multi_vpaned, FALSE);
 }
@@ -774,7 +799,11 @@ on_trace_filter_activate              (GtkMenuItem     *menuitem,
     g_printf("There is no viewer yet\n");      
     return;
   }
-  get_filter_selection(s, "Configure trace and tracefile filter", "Select traces and tracefiles");
+  if(get_filter_selection(s, "Configure trace and tracefile filter", "Select traces and tracefiles")){
+    update_traceset(mw_data);
+    redraw_viewer(mw_data, &(mw_data->current_tab->time_window));
+    set_current_time(mw_data,&(mw_data->current_tab->current_time));
+  }
 }
 
 void
@@ -1109,7 +1138,7 @@ void update_filter(LttvTracesetSelector *s,  GtkTreeStore *store )
   }
 }
 
-void get_filter_selection(LttvTracesetSelector *s,char *title, char * column_title)
+gboolean get_filter_selection(LttvTracesetSelector *s,char *title, char * column_title)
 {
   GtkWidget         * dialogue;
   GtkTreeStore      * store;
@@ -1200,12 +1229,15 @@ void get_filter_selection(LttvTracesetSelector *s,char *title, char * column_tit
     case GTK_RESPONSE_ACCEPT:
     case GTK_RESPONSE_OK:
       update_filter(s, store);
+      gtk_widget_destroy(dialogue);
+      return TRUE;
     case GTK_RESPONSE_REJECT:
     case GTK_RESPONSE_CANCEL:
     default:
       gtk_widget_destroy(dialogue);
       break;
   }
+  return FALSE;
 }
 
 char * get_remove_trace(char ** all_trace_name, int nb_trace)
@@ -1524,8 +1556,10 @@ void * create_tab(MainWindow * parent, MainWindow* current_window,
               LTTV_TRACESET_CONTEXT(tmp_tab->traceset_info->traceset_context)->Time_Span->endTime.tv_sec;
     tmp_time.tv_nsec = 0;
     tmp_tab->time_window.time_width = tmp_time ;
-    tmp_tab->current_time.tv_sec = tmp_time.tv_sec / 2;
-    tmp_tab->current_time.tv_nsec = 0 ;
+    tmp_tab->current_time.tv_sec = 
+       LTTV_TRACESET_CONTEXT(tmp_tab->traceset_info->traceset_context)->Time_Span->startTime.tv_sec;
+    tmp_tab->current_time.tv_nsec = 
+       LTTV_TRACESET_CONTEXT(tmp_tab->traceset_info->traceset_context)->Time_Span->startTime.tv_nsec;
   }
   tmp_tab->attributes = LTTV_IATTRIBUTE(g_object_new(LTTV_ATTRIBUTE_TYPE, NULL));
   //  mw_data->current_tab = tmp_tab;
index ee167de98c0945a4895d9d9f1adf63a9332602d6..051147e75fb12933aa5ae9c1b74784231cef6dfa 100644 (file)
@@ -54,13 +54,6 @@ static LttvHooks  *before_event;
 /** Array containing instanced objects. Used when module is unloaded */
 static GSList *g_event_viewer_data_list = NULL ;
 
-/** hook functions for update time interval, current time ... */
-gboolean update_time_window(void * hook_data, void * call_data);
-gboolean update_current_time(void * hook_data, void * call_data);
-gboolean show_event_detail(void * hook_data, void * call_data);
-void remove_item_from_queue(GQueue * q, gboolean fromHead);
-void remove_all_items_from_queue(GQueue * q);
-
 typedef struct _RawTraceData{
   unsigned  cpu_id;
   char * event_name;
@@ -100,7 +93,8 @@ typedef struct _EventViewerData {
   unsigned     end_event_index;          //the last event shown in the window
   unsigned     size;                     //maxi number of events loaded when instance the viewer
   gboolean     shown;                    //indicate if event detail is shown or not
+  char *       filter_key;
+
   //scroll window containing Tree View
   GtkWidget * scroll_win;
 
@@ -129,6 +123,18 @@ typedef struct _EventViewerData {
 
 } EventViewerData ;
 
+/** hook functions for update time interval, current time ... */
+gboolean update_time_window(void * hook_data, void * call_data);
+gboolean update_current_time(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);
+void remove_item_from_queue(GQueue * q, gboolean fromHead);
+void remove_all_items_from_queue(GQueue * q);
+void add_context_hooks(EventViewerData * event_viewer_data, 
+                      LttvTracesetContext * tsc);
+void remove_context_hooks(EventViewerData * event_viewer_data, 
+                         LttvTracesetContext * tsc);
+
 //! Event Viewer's constructor hook
 GtkWidget *h_gui_events(MainWindow *parent_window, LttvTracesetSelector * s, char* key);
 //! Event Viewer's constructor
@@ -276,6 +282,7 @@ gui_events(MainWindow *parent_window, LttvTracesetSelector * s,char* key )
   reg_update_time_window(update_time_window,event_viewer_data, event_viewer_data->mw);
   reg_update_current_time(update_current_time,event_viewer_data, event_viewer_data->mw);
   reg_show_viewer(show_event_detail,event_viewer_data, event_viewer_data->mw);
+  reg_update_traceset(traceset_changed,event_viewer_data, event_viewer_data->mw);
 
   event_viewer_data->scroll_win = gtk_scrolled_window_new (NULL, NULL);
   gtk_widget_show ( event_viewer_data->scroll_win);
@@ -458,9 +465,10 @@ gui_events(MainWindow *parent_window, LttvTracesetSelector * s,char* key )
                    TRACESET_TIME_SPAN,
                    &event_viewer_data->time_span);
 
+  event_viewer_data->filter_key = g_strdup(key);
   g_object_set_data(
                    G_OBJECT(event_viewer_data->hbox_v),
-                   key,
+                   event_viewer_data->filter_key,
                    s);
   
   g_object_set_data_full(
@@ -774,6 +782,7 @@ void tree_v_size_request_cb (GtkWidget *widget, GtkRequisition *requisition, gpo
 gboolean show_event_detail(void * hook_data, void * call_data)
 {
   EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
+  LttvTracesetContext * tsc = get_traceset_context(event_viewer_data->mw);
 
   if(event_viewer_data->shown == FALSE){
     event_viewer_data->shown = TRUE;
@@ -783,9 +792,8 @@ gboolean show_event_detail(void * hook_data, void * call_data)
     get_test_data(event_viewer_data->vadjust_c->value,
                  event_viewer_data->num_visible_events, 
                  event_viewer_data);
-    //remove hooks from context
-    context_remove_hooks_api(event_viewer_data->mw, NULL, NULL, NULL, NULL, NULL, NULL,
-                            NULL, NULL, NULL,event_viewer_data->before_event_hooks,NULL);
+
+    remove_context_hooks(event_viewer_data,tsc);
   }
 
   return FALSE;
@@ -854,6 +862,7 @@ void get_test_data(double time_value, guint list_height,
            }
 
            first = event_viewer_data->raw_trace_data_queue->head;
+           if(!first)break;
            raw_data = (RawTraceData*)g_list_nth_data(first,0);
            end = raw_data->time;
            end.tv_nsec--;
@@ -915,6 +924,7 @@ void get_test_data(double time_value, guint list_height,
        if(event_viewer_data->end_event_index == event_viewer_data->number_of_events - 1){
          event_viewer_data->append = TRUE;
          first = event_viewer_data->raw_trace_data_queue->head;
+         if(!first)break;
          raw_data = (RawTraceData*)g_list_nth_data(first,event_viewer_data->number_of_events - 1);
          start = raw_data->time;
          start.tv_nsec++;
@@ -929,6 +939,7 @@ void get_test_data(double time_value, guint list_height,
        if(event_viewer_data->end_event_index >= event_viewer_data->number_of_events - 1 - list_height){
          event_viewer_data->append = TRUE;
          first = event_viewer_data->raw_trace_data_queue->head;
+         if(!first)break;
          raw_data = (RawTraceData*)g_list_nth_data(first,event_viewer_data->number_of_events - 1);
          start = raw_data->time;
          start.tv_nsec++;
@@ -953,6 +964,7 @@ void get_test_data(double time_value, guint list_height,
        if(size < list_height){
          event_viewer_data->append = FALSE;
          first = event_viewer_data->raw_trace_data_queue->head;
+         if(!first)break;
          raw_data = (RawTraceData*)g_list_nth_data(first,0);
          end = raw_data->time;
          end.tv_nsec--;
@@ -982,14 +994,18 @@ void get_test_data(double time_value, guint list_height,
          break;
     }
 
+    if(event_number < 0) event_number = 0;
+
     //update the value of the scroll bar
     if(direction != SCROLL_NONE && direction != SCROLL_JUMP){
       first = event_viewer_data->raw_trace_data_queue->head;
-      raw_data = (RawTraceData*)g_list_nth_data(first,event_number);
-      time = ltt_time_sub(raw_data->time, event_viewer_data->time_span.startTime);
-      event_viewer_data->vadjust_c->value = ltt_time_to_double(time) * NANOSECONDS_PER_SECOND;
-      g_signal_stop_emission_by_name(G_OBJECT(event_viewer_data->vadjust_c), "value-changed");
-      event_viewer_data->previous_value = event_viewer_data->vadjust_c->value;
+      if(first){
+       raw_data = (RawTraceData*)g_list_nth_data(first,event_number);
+       time = ltt_time_sub(raw_data->time, event_viewer_data->time_span.startTime);
+       event_viewer_data->vadjust_c->value = ltt_time_to_double(time) * NANOSECONDS_PER_SECOND;
+       g_signal_stop_emission_by_name(G_OBJECT(event_viewer_data->vadjust_c), "value-changed");
+       event_viewer_data->previous_value = event_viewer_data->vadjust_c->value;
+      }
     }
     
 
@@ -998,6 +1014,13 @@ void get_test_data(double time_value, guint list_height,
 
     first = event_viewer_data->raw_trace_data_queue->head;
     gtk_list_store_clear(event_viewer_data->store_m);
+    if(!first){
+      //      event_viewer_data->previous_value = 0;
+      //      event_viewer_data->vadjust_c->value = 0.0;
+      //      gtk_widget_hide(event_viewer_data->vscroll_vc);
+      goto LAST;
+    }else gtk_widget_show(event_viewer_data->vscroll_vc);
+
     for(i=event_number; i<event_number+list_height; i++)
       {
        guint64 real_data;
@@ -1093,6 +1116,7 @@ void get_test_data(double time_value, guint list_height,
   event_viewer_data->first_event = event_viewer_data->start_event_index ;
   event_viewer_data->last_event = event_viewer_data->end_event_index ;
 
+ LAST:
   if(widget)
      gdk_window_set_cursor(win, NULL);  
 
@@ -1134,6 +1158,7 @@ gui_events_free(EventViewerData *event_viewer_data)
     unreg_update_time_window(update_time_window,event_viewer_data, event_viewer_data->mw);
     unreg_update_current_time(update_current_time,event_viewer_data, event_viewer_data->mw);
     unreg_show_viewer(show_event_detail,event_viewer_data, event_viewer_data->mw);
+    unreg_update_traceset(traceset_changed,event_viewer_data, event_viewer_data->mw);
 
     g_event_viewer_data_list = g_slist_remove(g_event_viewer_data_list, event_viewer_data);
     g_free(event_viewer_data);
@@ -1148,6 +1173,7 @@ gui_events_destructor(EventViewerData *event_viewer_data)
   /* May already been done by GTK window closing */
   if(GTK_IS_WIDGET(event_viewer_data->hbox_v)){
     gtk_widget_destroy(event_viewer_data->hbox_v);
+    g_free(event_viewer_data->filter_key);
     event_viewer_data = NULL;
   }
   
@@ -1193,16 +1219,118 @@ int event_selected_hook(void *hook_data, void *call_data)
 }
 
 
+void add_context_hooks(EventViewerData * event_viewer_data, 
+                      LttvTracesetContext * tsc)
+{
+  gint i, j, nbi, nb_tracefile, nb_control, nb_per_cpu;
+  LttTrace *trace;
+  LttvTraceContext *tc;
+  LttvTracefileContext *tfc;
+  LttvTracesetSelector  * ts_s;
+  LttvTraceSelector     * t_s;
+  LttvTracefileSelector * tf_s;
+  gboolean selected;
+
+  ts_s = (LttvTracesetSelector*)g_object_get_data(G_OBJECT(event_viewer_data->hbox_v), 
+                                                 event_viewer_data->filter_key);
+
+  //if there are hooks for traceset, add them here
+  
+  nbi = lttv_traceset_number(tsc->ts);
+  for(i = 0 ; i < nbi ; i++) {
+    t_s = lttv_traceset_selector_get(ts_s,i);
+    selected = lttv_trace_selector_get_selected(t_s);
+    if(!selected) continue;
+    tc = tsc->traces[i];
+    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;
+    
+    for(j = 0 ; j < nb_tracefile ; j++) {
+      tf_s = lttv_trace_selector_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];
+      
+      //if there are hooks for tracefile, add them here
+      lttv_tracefile_context_add_hooks(tfc, NULL,NULL,NULL,NULL,
+                                      event_viewer_data->before_event_hooks,NULL);
+    }
+  }
+  
+  //add hooks for process_traceset
+  //    context_add_hooks_api(event_viewer_data->mw, NULL, NULL, NULL, NULL, NULL, NULL,
+  //                     NULL, NULL, NULL,event_viewer_data->before_event_hooks,NULL);  
+}
+
+
+void remove_context_hooks(EventViewerData * event_viewer_data, 
+                         LttvTracesetContext * tsc)
+{
+  gint i, j, nbi, nb_tracefile, nb_control, nb_per_cpu;
+  LttTrace *trace;
+  LttvTraceContext *tc;
+  LttvTracefileContext *tfc;
+  LttvTracesetSelector  * ts_s;
+  LttvTraceSelector     * t_s;
+  LttvTracefileSelector * tf_s;
+  gboolean selected;
+
+  ts_s = (LttvTracesetSelector*)g_object_get_data(G_OBJECT(event_viewer_data->hbox_v), 
+                                                 event_viewer_data->filter_key);
+
+  //if there are hooks for traceset, remove them here
+  
+  nbi = lttv_traceset_number(tsc->ts);
+  for(i = 0 ; i < nbi ; i++) {
+    t_s = lttv_traceset_selector_get(ts_s,i);
+    selected = lttv_trace_selector_get_selected(t_s);
+    if(!selected) continue;
+    tc = tsc->traces[i];
+    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;
+    
+    for(j = 0 ; j < nb_tracefile ; j++) {
+      tf_s = lttv_trace_selector_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];
+      
+      //if there are hooks for tracefile, remove them here
+      lttv_tracefile_context_remove_hooks(tfc, NULL,NULL,NULL,NULL,
+                                         event_viewer_data->before_event_hooks,NULL);
+    }
+  }
+  //remove hooks from context
+  //    context_remove_hooks_api(event_viewer_data->mw, NULL, NULL, NULL, NULL, NULL, NULL,
+  //                        NULL, NULL, NULL,event_viewer_data->before_event_hooks,NULL);
+}
+
+
 gboolean update_time_window(void * hook_data, void * call_data)
 {
   EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
+  LttvTracesetContext * tsc = get_traceset_context(event_viewer_data->mw);
 
   if(event_viewer_data->shown == FALSE){
     event_viewer_data->time_window = *(TimeWindow*)call_data;
-
-    //add hooks for process_traceset
-    context_add_hooks_api(event_viewer_data->mw, NULL, NULL, NULL, NULL, NULL, NULL,
-                         NULL, NULL, NULL,event_viewer_data->before_event_hooks,NULL);  
+    
+    add_context_hooks(event_viewer_data, tsc);
   }
 
   return FALSE;
@@ -1238,6 +1366,25 @@ gboolean update_current_time(void * hook_data, void * call_data)
   return FALSE;
 }
 
+gboolean traceset_changed(void * hook_data, void * call_data)
+{
+  EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
+  LttTime start;
+  
+  remove_all_items_from_queue(event_viewer_data->raw_trace_data_queue);
+  gtk_list_store_clear(event_viewer_data->store_m);
+  event_viewer_data->shown = FALSE;
+  event_viewer_data->append = TRUE;
+
+  get_traceset_time_span(event_viewer_data->mw, &event_viewer_data->time_span);
+  start = ltt_time_sub(event_viewer_data->time_span.endTime, event_viewer_data->time_span.startTime);
+  event_viewer_data->vadjust_c->upper = ltt_time_to_double(start) * NANOSECONDS_PER_SECOND;
+  //  event_viewer_data->vadjust_c->value = 0;
+
+  return FALSE;
+}
+
+
 void tree_v_grab_focus(GtkWidget *widget, gpointer data){
   EventViewerData *event_viewer_data = (EventViewerData *)data;
   MainWindow * mw = event_viewer_data->mw;
@@ -1309,11 +1456,17 @@ void get_events(EventViewerData* event_viewer_data, LttTime start,
                LttTime end,unsigned max_num_events, unsigned * real_num_events)
 {
   int size;
-  context_add_hooks_api(event_viewer_data->mw, NULL, NULL, NULL, NULL, NULL, NULL,
-                       NULL, NULL, NULL,event_viewer_data->before_event_hooks,NULL);
+  LttvTracesetContext * tsc = get_traceset_context(event_viewer_data->mw);
+
+  //  context_add_hooks_api(event_viewer_data->mw, NULL, NULL, NULL, NULL, NULL, NULL,
+  //                   NULL, NULL, NULL,event_viewer_data->before_event_hooks,NULL);
+  add_context_hooks(event_viewer_data,tsc);
+
   process_traceset_api(event_viewer_data->mw, start, end, max_num_events);
-  context_remove_hooks_api(event_viewer_data->mw, NULL, NULL, NULL, NULL, NULL, NULL,
-                          NULL, NULL, NULL,event_viewer_data->before_event_hooks,NULL);
+
+  remove_context_hooks(event_viewer_data,tsc);
+  //  context_remove_hooks_api(event_viewer_data->mw, NULL, NULL, NULL, NULL, NULL, NULL,
+  //                      NULL, NULL, NULL,event_viewer_data->before_event_hooks,NULL);
 
   size = event_viewer_data->raw_trace_data_queue_tmp->length;
   *real_num_events = size;
index 31fece3d0e297a723a53c01006255d508e5db9d4..2f54a22d1db24e5750081440af84de10a2a6d1ad 100644 (file)
@@ -46,7 +46,6 @@ static void tree_selection_changed_cb (GtkTreeSelection *selection, gpointer dat
 void statistic_destroy_hash_key(gpointer key);
 void statistic_destroy_hash_data(gpointer data);
 
-void get_traceset_stats(StatisticViewerData * statistic_viewer_data);
 void show_traceset_stats(StatisticViewerData * statistic_viewer_data);
 void show_tree(StatisticViewerData * statistic_viewer_data,
               LttvAttribute* stats,  GtkTreeIter* parent);
@@ -54,6 +53,15 @@ void show_statistic(StatisticViewerData * statistic_viewer_data,
                    LttvAttribute* stats, GtkTextBuffer* buf);
 
 
+/** hook functions for update time interval, current time ... */
+gboolean statistic_update_time_window(void * hook_data, void * call_data);
+gboolean statistic_show_viewer(void * hook_data, void * call_data);
+gboolean statistic_traceset_changed(void * hook_data, void * call_data);
+void statistic_add_context_hooks(StatisticViewerData * statistic_viewer_data, 
+                      LttvTracesetContext * tsc);
+void statistic_remove_context_hooks(StatisticViewerData * statistic_viewer_data, 
+                         LttvTracesetContext * tsc);
+
 enum
 {
    NAME_COLUMN,
@@ -64,6 +72,10 @@ struct _StatisticViewerData{
   MainWindow * mw;
   LttvTracesetStats * stats;
 
+  TimeInterval time_span;
+  gboolean     shown;       //indicate if the statistic is shown or not
+  char *       filter_key;
+
   GtkWidget    * hpaned_v;
   GtkTreeStore * store_m;
   GtkWidget    * tree_v;
@@ -137,7 +149,12 @@ void
 gui_statistic_free(StatisticViewerData *statistic_viewer_data)
 { 
   if(statistic_viewer_data){
+    unreg_update_time_window(statistic_update_time_window,statistic_viewer_data, statistic_viewer_data->mw);
+    unreg_show_viewer(statistic_show_viewer,statistic_viewer_data, statistic_viewer_data->mw);
+    unreg_update_traceset(statistic_traceset_changed,statistic_viewer_data, statistic_viewer_data->mw);
+
     g_hash_table_destroy(statistic_viewer_data->statistic_hash);
+    g_free(statistic_viewer_data->filter_key);
     g_statistic_viewer_data_list = g_slist_remove(g_statistic_viewer_data_list, statistic_viewer_data);
     g_free(statistic_viewer_data);
   }
@@ -191,6 +208,10 @@ gui_statistic(MainWindow *parent_window, LttvTracesetSelector * s, char* key)
   statistic_viewer_data->mw     = parent_window;
   statistic_viewer_data->stats  = get_traceset_stats_api(statistic_viewer_data->mw);
 
+  reg_update_time_window(statistic_update_time_window,statistic_viewer_data, statistic_viewer_data->mw);
+  reg_show_viewer(statistic_show_viewer,statistic_viewer_data, statistic_viewer_data->mw);
+  reg_update_traceset(statistic_traceset_changed,statistic_viewer_data, statistic_viewer_data->mw);
+
   statistic_viewer_data->statistic_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
                                                                statistic_destroy_hash_key,
                                                                statistic_destroy_hash_data);
@@ -251,11 +272,21 @@ gui_statistic(MainWindow *parent_window, LttvTracesetSelector * s, char* key)
   gtk_widget_show(statistic_viewer_data->text_v);
   gtk_widget_show(statistic_viewer_data->hpaned_v);
 
+  //get the life span of the traceset and set the upper of the scroll bar
+  get_traceset_time_span(statistic_viewer_data->mw, &statistic_viewer_data->time_span);
+
+  statistic_viewer_data->shown = FALSE;  
+  statistic_viewer_data->filter_key = g_strdup(key);
   g_object_set_data(
                    G_OBJECT(statistic_viewer_data->hpaned_v),
-                   key,
+                   statistic_viewer_data->filter_key,
                    s);
 
+  g_object_set_data(
+                   G_OBJECT(statistic_viewer_data->hpaned_v),
+                   TRACESET_TIME_SPAN,
+                   &statistic_viewer_data->time_span);
+
   g_object_set_data_full(
                        G_OBJECT(statistic_viewer_data->hpaned_v),
                        "statistic_viewer_data",
@@ -267,8 +298,6 @@ gui_statistic(MainWindow *parent_window, LttvTracesetSelector * s, char* key)
                        g_statistic_viewer_data_list,
                        statistic_viewer_data);
 
-  get_traceset_stats(statistic_viewer_data);
-
   return statistic_viewer_data;
 }
 
@@ -324,27 +353,6 @@ void statistic_destroy_hash_data(gpointer data)
   //  g_free(data);
 }
 
-void get_traceset_stats(StatisticViewerData * statistic_viewer_data)
-{
-  LttTime start, end;
-
-  start.tv_sec = 0;
-  start.tv_nsec = 0;
-  end.tv_sec = G_MAXULONG;
-  end.tv_nsec = G_MAXULONG;
-  
-  state_add_event_hooks_api(statistic_viewer_data->mw);
-  stats_add_event_hooks_api(statistic_viewer_data->mw);
-
-  process_traceset_api(statistic_viewer_data->mw, start, end, G_MAXULONG);
-  
-  state_remove_event_hooks_api(statistic_viewer_data->mw);
-  stats_remove_event_hooks_api(statistic_viewer_data->mw);
-
-  //establish tree view for stats
-  show_traceset_stats(statistic_viewer_data);
-}
-
 void show_traceset_stats(StatisticViewerData * statistic_viewer_data)
 {
   int i, nb;
@@ -491,4 +499,142 @@ void show_statistic(StatisticViewerData * statistic_viewer_data,
   }
 }
 
+gboolean statistic_update_time_window(void * hook_data, void * call_data)
+{
+  StatisticViewerData *statistic_viewer_data = (StatisticViewerData*) hook_data;
+  LttvTracesetContext * tsc = get_traceset_context(statistic_viewer_data->mw);
+
+  if(statistic_viewer_data->shown == FALSE){    
+    statistic_add_context_hooks(statistic_viewer_data, tsc);
+  }
+  return FALSE;
+}
+
+gboolean statistic_show_viewer(void * hook_data, void * call_data)
+{
+  StatisticViewerData *statistic_viewer_data = (StatisticViewerData*) hook_data;
+  LttvTracesetContext * tsc = get_traceset_context(statistic_viewer_data->mw);
+
+  if(statistic_viewer_data->shown == FALSE){
+    statistic_viewer_data->shown = TRUE;
+    show_traceset_stats(statistic_viewer_data);
+    statistic_remove_context_hooks(statistic_viewer_data,tsc);
+  }
+
+  return FALSE;
+}
+
+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;
+
+  return FALSE;
+}
+
+void statistic_add_context_hooks(StatisticViewerData * statistic_viewer_data, 
+                      LttvTracesetContext * tsc)
+{
+  gint i, j, nbi, nb_tracefile, nb_control, nb_per_cpu;
+  LttTrace *trace;
+  LttvTraceContext *tc;
+  LttvTracefileContext *tfc;
+  LttvTracesetSelector  * ts_s;
+  LttvTraceSelector     * t_s;
+  LttvTracefileSelector * tf_s;
+  gboolean selected;
+
+  ts_s = (LttvTracesetSelector*)g_object_get_data(G_OBJECT(statistic_viewer_data->hpaned_v), 
+                                                 statistic_viewer_data->filter_key);
+
+  //if there are hooks for traceset, add them here
+  
+  nbi = lttv_traceset_number(tsc->ts);
+  for(i = 0 ; i < nbi ; i++) {
+    t_s = lttv_traceset_selector_get(ts_s,i);
+    selected = lttv_trace_selector_get_selected(t_s);
+    if(!selected) continue;
+    tc = tsc->traces[i];
+    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;
+    
+    for(j = 0 ; j < nb_tracefile ; j++) {
+      tf_s = lttv_trace_selector_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];
+      
+      //if there are hooks for tracefile, add them here
+      //      lttv_tracefile_context_add_hooks(tfc, NULL,NULL,NULL,NULL,
+      //                                      statistic_viewer_data->before_event_hooks,NULL);
+    }
+  }  
+
+  //add state and stats hooks
+  state_add_event_hooks_api(statistic_viewer_data->mw);
+  stats_add_event_hooks_api(statistic_viewer_data->mw);
+  
+}
+
+void statistic_remove_context_hooks(StatisticViewerData * statistic_viewer_data, 
+                         LttvTracesetContext * tsc)
+{
+  gint i, j, nbi, nb_tracefile, nb_control, nb_per_cpu;
+  LttTrace *trace;
+  LttvTraceContext *tc;
+  LttvTracefileContext *tfc;
+  LttvTracesetSelector  * ts_s;
+  LttvTraceSelector     * t_s;
+  LttvTracefileSelector * tf_s;
+  gboolean selected;
+
+  ts_s = (LttvTracesetSelector*)g_object_get_data(G_OBJECT(statistic_viewer_data->hpaned_v), 
+                                                 statistic_viewer_data->filter_key);
+
+  //if there are hooks for traceset, remove them here
+  
+  nbi = lttv_traceset_number(tsc->ts);
+  for(i = 0 ; i < nbi ; i++) {
+    t_s = lttv_traceset_selector_get(ts_s,i);
+    selected = lttv_trace_selector_get_selected(t_s);
+    if(!selected) continue;
+    tc = tsc->traces[i];
+    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;
+    
+    for(j = 0 ; j < nb_tracefile ; j++) {
+      tf_s = lttv_trace_selector_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];
+      
+      //if there are hooks for tracefile, remove them here
+      //      lttv_tracefile_context_remove_hooks(tfc, NULL,NULL,NULL,NULL,
+      //                                         statistic_viewer_data->before_event_hooks,NULL);
+    }
+  }
+
+  //remove state and stats hooks
+  state_remove_event_hooks_api(statistic_viewer_data->mw);
+  stats_remove_event_hooks_api(statistic_viewer_data->mw);
+}
+
 
index 92c19758dbd4cfc58ea3b0e9428cfae07474f247..700a81e1dd2488f2dcf337483b89385812b0bfc3 100644 (file)
@@ -316,6 +316,76 @@ void lttv_traceset_context_remove_hooks(LttvTracesetContext *self,
   }
 }
 
+void lttv_trace_context_add_hooks(LttvTraceContext *tc,
+                                 LttvHooks *check_trace, 
+                                 LttvHooks *before_trace, 
+                                 LttvHooks *after_trace)
+{
+  lttv_hooks_add_list(tc->check, check_trace);
+  lttv_hooks_add_list(tc->before, before_trace);
+  lttv_hooks_add_list(tc->after, after_trace);
+}
+
+void lttv_trace_context_remove_hooks(LttvTraceContext *tc,
+                                    LttvHooks *check_trace, 
+                                    LttvHooks *before_trace, 
+                                    LttvHooks *after_trace)
+{
+  lttv_hooks_remove_list(tc->check, check_trace);
+  lttv_hooks_remove_list(tc->before, before_trace);
+  lttv_hooks_remove_list(tc->after, after_trace);
+}
+
+void lttv_tracefile_context_add_hooks(LttvTracefileContext *tfc,
+                                     LttvHooks *check_tracefile,
+                                     LttvHooks *before_tracefile,
+                                     LttvHooks *after_tracefile,
+                                     LttvHooks *check_event, 
+                                     LttvHooks *before_event, 
+                                     LttvHooks *after_event)
+{
+  lttv_hooks_add_list(tfc->check, check_tracefile);
+  lttv_hooks_add_list(tfc->before, before_tracefile);
+  lttv_hooks_add_list(tfc->after, after_tracefile);
+  lttv_hooks_add_list(tfc->check_event, check_event);
+  lttv_hooks_add_list(tfc->before_event, before_event);
+  lttv_hooks_add_list(tfc->after_event, after_event);
+}
+
+void lttv_tracefile_context_remove_hooks(LttvTracefileContext *tfc,
+                                        LttvHooks *check_tracefile,
+                                        LttvHooks *before_tracefile,
+                                        LttvHooks *after_tracefile,
+                                        LttvHooks *check_event, 
+                                        LttvHooks *before_event, 
+                                        LttvHooks *after_event)
+{
+  lttv_hooks_remove_list(tfc->check, check_tracefile);
+  lttv_hooks_remove_list(tfc->before, before_tracefile);
+  lttv_hooks_remove_list(tfc->after, after_tracefile);
+  lttv_hooks_remove_list(tfc->check_event, check_event);
+  lttv_hooks_remove_list(tfc->before_event, before_event);
+  lttv_hooks_remove_list(tfc->after_event, after_event);
+}
+
+void lttv_tracefile_context_add_hooks_by_id(LttvTracefileContext *tfc,
+                                           unsigned i,
+                                           LttvHooks *before_event_by_id, 
+                                           LttvHooks *after_event_by_id)
+{
+  LttvHooks * h;
+  h = lttv_hooks_by_id_find(tfc->before_event_by_id, i);
+  lttv_hooks_add_list(h, before_event_by_id);
+  h = lttv_hooks_by_id_find(tfc->after_event_by_id, i);
+  lttv_hooks_add_list(h, after_event_by_id);
+}
+
+void lttv_tracefile_context_remove_hooks_by_id(LttvTracefileContext *tfc,
+                                              unsigned i)
+{
+  lttv_hooks_by_id_remove(tfc->before_event_by_id, i);
+  lttv_hooks_by_id_remove(tfc->after_event_by_id, i);
+}
 
 static LttvTracesetContext *
 new_traceset_context(LttvTracesetContext *self)
@@ -556,8 +626,11 @@ void lttv_process_traceset(LttvTracesetContext *self, LttTime end,
           g_ptr_array_add(tracefiles, tfc);
           lttv_hooks_call(tfc->before, tfc);
 
-          if(event != NULL) {
-            g_tree_insert(pqueue, &(tfc->timestamp), tfc);
+          if(tfc->e != NULL) {
+           if(tfc->timestamp.tv_sec < end.tv_sec ||
+              (tfc->timestamp.tv_sec == end.tv_sec && tfc->timestamp.tv_nsec <= end.tv_nsec)){
+             g_tree_insert(pqueue, &(tfc->timestamp), tfc);
+           }
           }
         }
       }
This page took 0.039138 seconds and 4 git commands to generate.