}
+/**
+ * Function to register a hook function for a viewer to show
+ *the content of the viewer.
+ * It will be called by the constructor of the viewer.
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ * @param main_win the main window the viewer belongs to.
+ */
+
+void reg_show_viewer(LttvHook hook, gpointer hook_data,
+ MainWindow *main_win)
+{
+ LttvAttributeValue value;
+ LttvHooks * tmp;
+ g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
+ "hooks/showviewer", LTTV_POINTER, &value));
+ tmp = (LttvHooks*)*(value.v_pointer);
+ if(tmp == NULL){
+ tmp = lttv_hooks_new();
+ *(value.v_pointer) = tmp;
+ }
+ lttv_hooks_add(tmp, hook, hook_data);
+}
+
+
+/**
+ * Function to unregister a viewer's hook function which is used to
+ * show the content of the viewer..
+ * It will be called by the destructor of the viewer.
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ * @param main_win the main window the viewer belongs to.
+ */
+
+void unreg_show_viewer(LttvHook hook, gpointer hook_data,
+ MainWindow * main_win)
+{
+ LttvAttributeValue value;
+ LttvHooks * tmp;
+ g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
+ "hooks/showviewer", LTTV_POINTER, &value));
+ tmp = (LttvHooks*)*(value.v_pointer);
+ if(tmp == NULL) return;
+ lttv_hooks_remove_data(tmp, hook, hook_data);
+}
+
+
+/**
+ * Function to show each viewer in the current tab.
+ * It will be called by main window after it called process_traceset
+ * @param main_win the main window the viewer belongs to.
+ */
+
+void show_viewer(MainWindow *main_win)
+{
+ LttvAttributeValue value;
+ LttvHooks * tmp;
+ g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
+ "hooks/showviewer", LTTV_POINTER, &value));
+ tmp = (LttvHooks*)*(value.v_pointer);
+ if(tmp == NULL) return;
+ lttv_hooks_call(tmp, NULL);
+}
+
+
/**
* Function to set the focused pane (viewer).
* It will be called by a viewer's signal handle associated with
LttvTracesetSelector * construct_traceset_selector(LttvTraceset * traceset);
+void redraw_viewer(MainWindow * mw_data, TimeWindow * time_window, unsigned nb_events);
+
+
enum {
CHECKBOX_COLUMN,
NAME_COLUMN,
MainWindow * mw_data;
GtkWidget * viewer;
LttvTracesetSelector * s;
+ unsigned * size;
+ TimeInterval * time_interval;
+ TimeWindow time_window;
mw_data = get_window_data_struct(widget);
if(!mw_data->current_tab) return;
gtk_multi_vpaned_widget_add(multi_vpaned, viewer);
// 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){
+ time_window.start_time = time_interval->startTime;
+ time_window.time_width = ltt_time_sub(time_interval->endTime,time_interval->startTime);
+ }
+
+ redraw_viewer(mw_data,&time_window, *size);
+ set_current_time(mw_data,&(mw_data->current_tab->current_time));
}
}
}
+void redraw_viewer(MainWindow * mw_data, TimeWindow * time_window, unsigned nb_events)
+{
+ //update time window of each viewer, let viewer insert hooks needed by process_traceset
+ set_time_window(mw_data, time_window);
+
+ process_traceset_api(mw_data, time_window->start_time,
+ ltt_time_add(time_window->start_time,time_window->time_width),
+ nb_events);
+
+ //call hooks to show each viewer and let them remove hooks
+ show_viewer(mw_data);
+}
+
void add_trace_into_traceset_selector(GtkMultiVPaned * paned, LttTrace * t)
{
int j, nb_tracefile, nb_control, nb_per_cpu;
gtk_widget_destroy((GtkWidget*)file_selector);
//update current tab
- // set_current_time(mw_data, &(mw_data->current_tab->current_time));
+ redraw_viewer(mw_data, &(mw_data->current_tab->time_window), G_MAXULONG);
+ set_current_time(mw_data,&(mw_data->current_tab->current_time));
break;
case GTK_RESPONSE_REJECT:
case GTK_RESPONSE_CANCEL:
LTTV_TRACESET_CONTEXT(mw_data->current_tab->
traceset_info->traceset_context),traceset);
//update current tab
- // set_current_time(mw_data, &(mw_data->current_tab->current_time));
+ redraw_viewer(mw_data, &(mw_data->current_tab->time_window), G_MAXULONG);
+ set_current_time(mw_data,&(mw_data->current_tab->current_time));
}
break;
}
}
time_window.start_time = time_s;
}
- set_time_window(mw_data, &time_window);
+ redraw_viewer(mw_data, &time_window, G_MAXULONG);
+ set_current_time(mw_data,&(mw_data->current_tab->current_time));
gtk_multi_vpaned_set_adjust(mw_data->current_tab->multi_vpaned, FALSE);
}
/** 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);
unsigned current_event_index;
double previous_value; //value of the slide
TimeInterval time_span;
- // LttTime trace_start;
- // LttTime trace_end;
unsigned start_event_index; //the first event shown in the window
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
+
//scroll window containing Tree View
GtkWidget * scroll_win;
void add_test_data(EventViewerData *event_viewer_data);
+static void update_raw_data_array(EventViewerData* event_viewer_data, unsigned size);
+
static void get_events(EventViewerData* event_viewer_data, LttTime start,
LttTime end, unsigned max_num_events, unsigned * real_num_events);
static gboolean parse_event(void *hook_data, void *call_data);
GtkCellRenderer *renderer;
EventViewerData* event_viewer_data = g_new(EventViewerData,1) ;
RawTraceData * data;
- unsigned size;
event_viewer_data->mw = parent_window;
get_time_window(event_viewer_data->mw, &event_viewer_data->time_window);
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);
event_viewer_data->scroll_win = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show ( event_viewer_data->scroll_win);
event_viewer_data->append = TRUE;
- start.tv_sec = 0;
- start.tv_nsec = 0;
- end.tv_sec = G_MAXULONG;
- end.tv_nsec = G_MAXULONG;
-
- get_events(event_viewer_data, start,end, RESERVE_SMALL_SIZE, &size);
-
event_viewer_data->start_event_index = 0;
event_viewer_data->end_event_index = event_viewer_data->num_visible_events - 1;
- // Test data
- get_test_data(event_viewer_data->vadjust_c->value,
- event_viewer_data->num_visible_events,
- event_viewer_data);
-
/* Set the Selected Event */
// tree_v_set_cursor(event_viewer_data);
+ event_viewer_data->shown = FALSE;
+ event_viewer_data->size = RESERVE_SMALL_SIZE;
+ g_object_set_data(
+ G_OBJECT(event_viewer_data->hbox_v),
+ MAX_NUMBER_EVENT,
+ &event_viewer_data->size);
+
+ g_object_set_data(
+ G_OBJECT(event_viewer_data->hbox_v),
+ TRACESET_TIME_SPAN,
+ &event_viewer_data->time_span);
g_object_set_data(
G_OBJECT(event_viewer_data->hbox_v),
}
+gboolean show_event_detail(void * hook_data, void * call_data)
+{
+ EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
+
+ if(event_viewer_data->shown == FALSE){
+ event_viewer_data->shown = TRUE;
+ update_raw_data_array(event_viewer_data,
+ event_viewer_data->raw_trace_data_queue_tmp->length);
+
+ 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);
+ }
+
+ return FALSE;
+}
+
void get_test_data(double time_value, guint list_height,
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);
g_event_viewer_data_list = g_slist_remove(g_event_viewer_data_list, event_viewer_data);
g_free(event_viewer_data);
gboolean update_time_window(void * hook_data, void * call_data)
{
EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
- event_viewer_data->time_window = *(TimeWindow*)call_data;
+
+ 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);
+ }
return FALSE;
}
set_focused_pane(mw, gtk_widget_get_parent(event_viewer_data->hbox_v));
}
-void get_events(EventViewerData* event_viewer_data, LttTime start,
- LttTime end,unsigned max_num_events, unsigned * real_num_events)
+void update_raw_data_array(EventViewerData* event_viewer_data, unsigned size)
{
- int size;
RawTraceData * data;
- context_add_hooks_api(event_viewer_data->mw, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL,event_viewer_data->before_event_hooks,NULL);
- 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);
-
- size = event_viewer_data->raw_trace_data_queue_tmp->length;
- *real_num_events = size;
if(size > 0){
int pid, tmpPid, i;
GList * list, *tmpList;
}
}
+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);
+ 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);
+
+ size = event_viewer_data->raw_trace_data_queue_tmp->length;
+ *real_num_events = size;
+
+ update_raw_data_array(event_viewer_data,size);
+}
+
static void get_event_detail(LttEvent *e, LttField *f, GString * s)
{
LttType *type;