X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Fcontrolflow%2Feventhooks.c;h=cffd9b89b9ccc6051f82beb2172af29fe5a81122;hb=c7620c793509802e9bc0b789a5b72b9510bb6b0e;hp=089cd5e9d17b415b37b1502cbb70c6c2f5d9ddc9;hpb=4a24fa1f30c23e86e928d2bdb6835da895cb3681;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index 089cd5e9..cffd9b89 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -61,7 +61,6 @@ #include #include -#include #include #include @@ -79,6 +78,8 @@ #define MAX_PATH_LEN 256 +#define STATE_LINE_WIDTH 4 +#define COLLISION_POSITION(height) (((height - STATE_LINE_WIDTH)/2) -3) extern GSList *g_legend_list; @@ -88,7 +89,7 @@ extern GSList *g_legend_list; * Wait for all the awaited computations to be over. */ -gint background_ready(void *hook_data, void *call_data) +static gint background_ready(void *hook_data, void *call_data) { ControlFlowData *control_flow_data = (ControlFlowData *)hook_data; LttvTrace *trace = (LttvTrace*)call_data; @@ -113,13 +114,14 @@ gint background_ready(void *hook_data, void *call_data) /* Request background computation. Verify if it is in progress or ready first. * Only for each trace in the tab's traceset. */ -void request_background_data(ControlFlowData *control_flow_data) +static void request_background_data(ControlFlowData *control_flow_data) { LttvTracesetContext * tsc = lttvwindow_get_traceset_context(control_flow_data->tab); gint num_traces = lttv_traceset_number(tsc->ts); gint i; LttvTrace *trace; + LttvTraceState *tstate; LttvHooks *background_ready_hook = lttv_hooks_new(); @@ -129,8 +131,10 @@ void request_background_data(ControlFlowData *control_flow_data) for(i=0;its, i); + tstate = LTTV_TRACE_STATE(tsc->traces[i]); - if(lttvwindowtraces_get_ready(g_quark_from_string("state"),trace)==FALSE) { + if(lttvwindowtraces_get_ready(g_quark_from_string("state"),trace)==FALSE + && !tstate->has_precomputed_states) { if(lttvwindowtraces_get_in_progress(g_quark_from_string("state"), trace) == FALSE) { @@ -138,9 +142,9 @@ void request_background_data(ControlFlowData *control_flow_data) * information. Happens when two viewers ask for it before servicing * starts. */ - lttvwindowtraces_background_request_remove(trace, "state"); - lttvwindowtraces_background_request_queue(trace, - "state"); + if(!lttvwindowtraces_background_request_find(trace, "state")) + lttvwindowtraces_background_request_queue( + main_window_get_widget(control_flow_data->tab), trace, "state"); lttvwindowtraces_background_notify_queue(control_flow_data, trace, ltt_time_infinite, @@ -157,8 +161,8 @@ void request_background_data(ControlFlowData *control_flow_data) control_flow_data->background_info_waiting++; } } else { - /* Data ready. Be its nature, this viewer doesn't need to have - * its data ready hook called htere, because a background + /* Data ready. By its nature, this viewer doesn't need to have + * its data ready hook called there, because a background * request is always linked with a redraw. */ } @@ -180,10 +184,12 @@ void request_background_data(ControlFlowData *control_flow_data) * @return The widget created. */ GtkWidget * -h_guicontrolflow(Tab *tab) +h_guicontrolflow(LttvPlugin *plugin) { + LttvPluginTab *ptab = LTTV_PLUGIN_TAB(plugin); + Tab *tab = ptab->tab; g_info("h_guicontrolflow, %p", tab); - ControlFlowData *control_flow_data = guicontrolflow() ; + ControlFlowData *control_flow_data = guicontrolflow(ptab); control_flow_data->tab = tab; @@ -211,46 +217,6 @@ h_guicontrolflow(Tab *tab) } -void legend_destructor(GtkWindow *legend) -{ - g_legend_list = g_slist_remove(g_legend_list, legend); -} - -/* Create a popup legend */ -GtkWidget * -h_legend(Tab *tab) -{ - g_info("h_legend, %p", tab); - - GtkWindow *legend = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); - - g_legend_list = g_slist_append( - g_legend_list, - legend); - - g_object_set_data_full( - G_OBJECT(legend), - "legend", - legend, - (GDestroyNotify)legend_destructor); - - gtk_window_set_title(legend, "Control Flow View Legend"); - - GtkWidget *pixmap = create_pixmap(GTK_WIDGET(legend), "lttv-color-list.png"); - - // GtkImage *image = GTK_IMAGE(gtk_image_new_from_pixmap( - // GDK_PIXMAP(pixmap), NULL)); - - gtk_container_add(GTK_CONTAINER(legend), GTK_WIDGET(pixmap)); - - gtk_widget_show(GTK_WIDGET(pixmap)); - gtk_widget_show(GTK_WIDGET(legend)); - - - return NULL; /* This is a popup window */ -} - - int event_selected_hook(void *hook_data, void *call_data) { ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; @@ -265,7 +231,7 @@ int event_selected_hook(void *hook_data, void *call_data) static inline PropertiesLine prepare_s_e_line(LttvProcessState *process) { PropertiesLine prop_line; - prop_line.line_width = 2; + prop_line.line_width = STATE_LINE_WIDTH; prop_line.style = GDK_LINE_SOLID; prop_line.y = MIDDLE; //GdkColormap *colormap = gdk_colormap_get_system(); @@ -279,6 +245,8 @@ static inline PropertiesLine prepare_s_e_line(LttvProcessState *process) prop_line.color = drawing_colors[COL_RUN_TRAP]; else if(process->state->t == LTTV_STATE_IRQ) prop_line.color = drawing_colors[COL_RUN_IRQ]; + else if(process->state->t == LTTV_STATE_SOFT_IRQ) + prop_line.color = drawing_colors[COL_RUN_SOFT_IRQ]; else if(process->state->t == LTTV_STATE_MODE_UNKNOWN) prop_line.color = drawing_colors[COL_MODE_UNKNOWN]; else @@ -298,8 +266,12 @@ static inline PropertiesLine prepare_s_e_line(LttvProcessState *process) prop_line.color = drawing_colors[COL_EXIT]; } else if(process->state->s == LTTV_STATE_UNNAMED) { prop_line.color = drawing_colors[COL_UNNAMED]; - } else + } else if(process->state->s == LTTV_STATE_DEAD) { + prop_line.color = drawing_colors[COL_DEAD]; + } else { + g_critical("unknown state : %s", g_quark_to_string(process->state->s)); g_assert(FALSE); /* UNKNOWN STATE */ + } return prop_line; @@ -326,8 +298,8 @@ static inline PropertiesLine prepare_s_e_line(LttvProcessState *process) int before_schedchange_hook(void *hook_data, void *call_data) { - LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; - EventsRequest *events_request = (EventsRequest*)thf->hook_data; + LttvTraceHook *th = (LttvTraceHook*)hook_data; + EventsRequest *events_request = (EventsRequest*)th->hook_data; ControlFlowData *control_flow_data = events_request->viewer_data; LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; @@ -337,8 +309,10 @@ int before_schedchange_hook(void *hook_data, void *call_data) LttEvent *e; e = ltt_tracefile_get_event(tfc->tf); + gint target_pid_saved = tfc->target_pid; LttTime evtime = ltt_event_time(e); + LttvFilter *filter = control_flow_data->filter; /* we are in a schedchange, before the state update. We must draw the * items corresponding to the state before it changes : now is the right @@ -347,24 +321,30 @@ int before_schedchange_hook(void *hook_data, void *call_data) guint pid_out; guint pid_in; + guint state_out; { - pid_out = ltt_event_get_long_unsigned(e, thf->f1); - pid_in = ltt_event_get_long_unsigned(e, thf->f2); + pid_out = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); + pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1)); + state_out = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 2)); } - { + tfc->target_pid = pid_out; + if(!filter || !filter->head || + lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc,NULL,NULL)) { /* For the pid_out */ /* First, check if the current process is in the state computation * process list. If it is there, that means we must add it right now and * draw items from the beginning of the read for it. If it is not * present, it's a new process and it was not present : it will * be added after the state update. */ - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; + guint trace_num = ts->parent.index; LttvProcessState *process = ts->running_process[cpu]; /* unknown state, bad current pid */ if(process->pid != pid_out) process = lttv_state_find_process(ts, - ltt_tracefile_num(tfc->tf), pid_out); + tfs->cpu, pid_out); if(process != NULL) { /* Well, the process_out existed : we must get it in the process hash @@ -380,7 +360,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) pid_out, process->cpu, &birth, - tfc->t_context->index); + trace_num); if(hashed_process_data == NULL) { g_assert(pid_out == 0 || pid_out != process->ppid); @@ -390,11 +370,13 @@ int before_schedchange_hook(void *hook_data, void *call_data) processlist_add(process_list, drawing, pid_out, + process->tgid, process->cpu, process->ppid, &birth, - tfc->t_context->index, + trace_num, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -419,7 +401,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) #ifdef EXTRA_CHECK if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1) - return; + return FALSE; #endif //EXTRA_CHECK Drawing_t *drawing = control_flow_data->drawing; guint width = drawing->width; @@ -435,7 +417,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) gdk_draw_point(hashed_process_data->pixmap, drawing->gc, x, - (hashed_process_data->height/2)-3); + COLLISION_POSITION(hashed_process_data->height)); hashed_process_data->x.middle_marked = TRUE; } } else { @@ -444,7 +426,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) #ifdef EXTRA_CHECK if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1) - return; + return FALSE; #endif //EXTRA_CHECK Drawing_t *drawing = control_flow_data->drawing; guint width = drawing->width; @@ -466,7 +448,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) gdk_draw_point(hashed_process_data->pixmap, drawing->gc, x, - (hashed_process_data->height/2)-3); + COLLISION_POSITION(hashed_process_data->height)); hashed_process_data->x.middle_marked = TRUE; } /* jump */ @@ -511,7 +493,10 @@ int before_schedchange_hook(void *hook_data, void *call_data) } } - { + tfc->target_pid = pid_in; + if(!filter || !filter->head || + lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc,NULL,NULL)) { /* For the pid_in */ /* First, check if the current process is in the state computation * process list. If it is there, that means we must add it right now and @@ -520,7 +505,8 @@ int before_schedchange_hook(void *hook_data, void *call_data) * be added after the state update. */ LttvProcessState *process; process = lttv_state_find_process(ts, - ltt_tracefile_num(tfc->tf), pid_in); + tfs->cpu, pid_in); + guint trace_num = ts->parent.index; if(process != NULL) { /* Well, the process existed : we must get it in the process hash @@ -534,9 +520,9 @@ int before_schedchange_hook(void *hook_data, void *call_data) hashed_process_data = processlist_get_process_data(process_list, pid_in, - process->cpu, + tfs->cpu, &birth, - tfc->t_context->index); + trace_num); if(hashed_process_data == NULL) { g_assert(pid_in == 0 || pid_in != process->ppid); @@ -546,11 +532,13 @@ int before_schedchange_hook(void *hook_data, void *call_data) processlist_add(process_list, drawing, pid_in, - process->cpu, + process->tgid, + tfs->cpu, process->ppid, &birth, - tfc->t_context->index, + trace_num, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -577,7 +565,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) #ifdef EXTRA_CHECK if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1) - return; + return FALSE; #endif //EXTRA_CHECK Drawing_t *drawing = control_flow_data->drawing; guint width = drawing->width; @@ -593,7 +581,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) gdk_draw_point(hashed_process_data->pixmap, drawing->gc, x, - (hashed_process_data->height/2)-3); + COLLISION_POSITION(hashed_process_data->height)); hashed_process_data->x.middle_marked = TRUE; } } else { @@ -602,7 +590,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) #ifdef EXTRA_CHECK if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1) - return; + return FALSE; #endif //EXTRA_CHECK Drawing_t *drawing = control_flow_data->drawing; guint width = drawing->width; @@ -625,7 +613,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) gdk_draw_point(hashed_process_data->pixmap, drawing->gc, x, - (hashed_process_data->height/2)-3); + COLLISION_POSITION(hashed_process_data->height)); hashed_process_data->x.middle_marked = TRUE; } /* jump */ @@ -668,8 +656,10 @@ int before_schedchange_hook(void *hook_data, void *call_data) &hashed_process_data->next_good_time); } } - } + } else + g_warning("Cannot find pin_in in schedchange %u", pid_in); } + tfc->target_pid = target_pid_saved; return 0; @@ -709,8 +699,8 @@ int before_schedchange_hook(void *hook_data, void *call_data) */ int after_schedchange_hook(void *hook_data, void *call_data) { - LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; - EventsRequest *events_request = (EventsRequest*)thf->hook_data; + LttvTraceHook *th = (LttvTraceHook*)hook_data; + EventsRequest *events_request = (EventsRequest*)th->hook_data; ControlFlowData *control_flow_data = events_request->viewer_data; LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; @@ -722,6 +712,7 @@ int after_schedchange_hook(void *hook_data, void *call_data) LttEvent *e; e = ltt_tracefile_get_event(tfc->tf); + LttvFilter *filter = control_flow_data->filter; LttTime evtime = ltt_event_time(e); /* Add process to process list (if not present) */ @@ -735,80 +726,88 @@ int after_schedchange_hook(void *hook_data, void *call_data) guint pid_in; { guint pid_out; - pid_out = ltt_event_get_long_unsigned(e, thf->f1); - pid_in = ltt_event_get_long_unsigned(e, thf->f2); + pid_out = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); + pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1)); } - - /* Find process pid_in in the list... */ - //process_in = lttv_state_find_process(ts, ANY_CPU, pid_in); - //process_in = tfs->process; - guint cpu = ltt_tracefile_num(tfc->tf); - process_in = ts->running_process[cpu]; - /* It should exist, because we are after the state update. */ + tfc->target_pid = pid_in; + if(!filter || !filter->head || + lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc,NULL,NULL)) { + /* Find process pid_in in the list... */ + //process_in = lttv_state_find_process(ts, ANY_CPU, pid_in); + //process_in = tfs->process; + guint cpu = tfs->cpu; + guint trace_num = ts->parent.index; + process_in = ts->running_process[cpu]; + /* It should exist, because we are after the state update. */ #ifdef EXTRA_CHECK - g_assert(process_in != NULL); + g_assert(process_in != NULL); #endif //EXTRA_CHECK - birth = process_in->creation_time; - - hashed_process_data_in = processlist_get_process_data(process_list, + birth = process_in->creation_time; + + hashed_process_data_in = processlist_get_process_data(process_list, + pid_in, + process_in->cpu, + &birth, + trace_num); + if(hashed_process_data_in == NULL) + { + g_assert(pid_in == 0 || pid_in != process_in->ppid); + ProcessInfo *process_info; + Drawing_t *drawing = control_flow_data->drawing; + /* Process not present */ + processlist_add(process_list, + drawing, pid_in, + process_in->tgid, process_in->cpu, + process_in->ppid, &birth, - tfc->t_context->index); - if(hashed_process_data_in == NULL) - { - g_assert(pid_in == 0 || pid_in != process_in->ppid); - ProcessInfo *process_info; - Drawing_t *drawing = control_flow_data->drawing; - /* Process not present */ - processlist_add(process_list, - drawing, - pid_in, - process_in->cpu, - process_in->ppid, - &birth, - tfc->t_context->index, - process_in->name, - &pl_height, - &process_info, - &hashed_process_data_in); - gtk_widget_set_size_request(drawing->drawing_area, - -1, - pl_height); - gtk_widget_queue_draw(drawing->drawing_area); - } - /* Set the current process */ - process_list->current_hash_data[process_in->cpu] = - hashed_process_data_in; - - if(ltt_time_compare(hashed_process_data_in->next_good_time, - evtime) <= 0) - { - TimeWindow time_window = - lttvwindow_get_time_window(control_flow_data->tab); - + trace_num, + process_in->name, + process_in->brand, + &pl_height, + &process_info, + &hashed_process_data_in); + gtk_widget_set_size_request(drawing->drawing_area, + -1, + pl_height); + gtk_widget_queue_draw(drawing->drawing_area); + } + /* Set the current process */ + process_list->current_hash_data[trace_num][process_in->cpu] = + hashed_process_data_in; + + if(ltt_time_compare(hashed_process_data_in->next_good_time, + evtime) <= 0) + { + TimeWindow time_window = + lttvwindow_get_time_window(control_flow_data->tab); + #ifdef EXTRA_CHECK - if(ltt_time_compare(evtime, time_window.start_time) == -1 - || ltt_time_compare(evtime, time_window.end_time) == 1) - return; + if(ltt_time_compare(evtime, time_window.start_time) == -1 + || ltt_time_compare(evtime, time_window.end_time) == 1) + return FALSE; #endif //EXTRA_CHECK - Drawing_t *drawing = control_flow_data->drawing; - guint width = drawing->width; - guint new_x; - - convert_time_to_pixels( - time_window, - evtime, - width, - &new_x); - - if(hashed_process_data_in->x.middle != new_x) { - hashed_process_data_in->x.middle = new_x; - hashed_process_data_in->x.middle_used = FALSE; - hashed_process_data_in->x.middle_marked = FALSE; + Drawing_t *drawing = control_flow_data->drawing; + guint width = drawing->width; + guint new_x; + + convert_time_to_pixels( + time_window, + evtime, + width, + &new_x); + + if(hashed_process_data_in->x.middle != new_x) { + hashed_process_data_in->x.middle = new_x; + hashed_process_data_in->x.middle_used = FALSE; + hashed_process_data_in->x.middle_marked = FALSE; + } } } + return 0; } @@ -835,8 +834,8 @@ int after_schedchange_hook(void *hook_data, void *call_data) int before_execmode_hook(void *hook_data, void *call_data) { - LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; - EventsRequest *events_request = (EventsRequest*)thf->hook_data; + LttvTraceHook *th = (LttvTraceHook*)hook_data; + EventsRequest *events_request = (EventsRequest*)th->hook_data; ControlFlowData *control_flow_data = events_request->viewer_data; LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; @@ -848,6 +847,12 @@ int before_execmode_hook(void *hook_data, void *call_data) LttEvent *e; e = ltt_tracefile_get_event(tfc->tf); + LttvFilter *filter = control_flow_data->filter; + if(filter != NULL && filter->head != NULL) + if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc,NULL,NULL)) + return FALSE; + LttTime evtime = ltt_event_time(e); /* we are in a execmode, before the state update. We must draw the @@ -856,7 +861,8 @@ int before_execmode_hook(void *hook_data, void *call_data) */ /* For the pid */ //LttvProcessState *process = tfs->process; - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; + guint trace_num = ts->parent.index; LttvProcessState *process = ts->running_process[cpu]; g_assert(process != NULL); @@ -871,14 +877,14 @@ int before_execmode_hook(void *hook_data, void *call_data) ProcessList *process_list = control_flow_data->process_list; LttTime birth = process->creation_time; - if(likely(process_list->current_hash_data[cpu] != NULL)) { - hashed_process_data = process_list->current_hash_data[cpu]; + if(likely(process_list->current_hash_data[trace_num][cpu] != NULL)) { + hashed_process_data = process_list->current_hash_data[trace_num][cpu]; } else { hashed_process_data = processlist_get_process_data(process_list, pid, process->cpu, &birth, - tfc->t_context->index); + trace_num); if(unlikely(hashed_process_data == NULL)) { g_assert(pid == 0 || pid != process->ppid); @@ -888,11 +894,13 @@ int before_execmode_hook(void *hook_data, void *call_data) processlist_add(process_list, drawing, pid, + process->tgid, process->cpu, process->ppid, &birth, - tfc->t_context->index, + trace_num, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -902,7 +910,7 @@ int before_execmode_hook(void *hook_data, void *call_data) gtk_widget_queue_draw(drawing->drawing_area); } /* Set the current process */ - process_list->current_hash_data[process->cpu] = + process_list->current_hash_data[trace_num][process->cpu] = hashed_process_data; } @@ -920,7 +928,7 @@ int before_execmode_hook(void *hook_data, void *call_data) #ifdef EXTRA_CHECK if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1) - return; + return FALSE; #endif //EXTRA_CHECK Drawing_t *drawing = control_flow_data->drawing; guint width = drawing->width; @@ -936,7 +944,7 @@ int before_execmode_hook(void *hook_data, void *call_data) gdk_draw_point(hashed_process_data->pixmap, drawing->gc, x, - (hashed_process_data->height/2)-3); + COLLISION_POSITION(hashed_process_data->height)); hashed_process_data->x.middle_marked = TRUE; } } else { @@ -946,7 +954,7 @@ int before_execmode_hook(void *hook_data, void *call_data) #ifdef EXTRA_CHECK if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1) - return; + return FALSE; #endif //EXTRA_CHECK Drawing_t *drawing = control_flow_data->drawing; guint width = drawing->width; @@ -969,7 +977,7 @@ int before_execmode_hook(void *hook_data, void *call_data) gdk_draw_point(hashed_process_data->pixmap, drawing->gc, x, - (hashed_process_data->height/2)-3); + COLLISION_POSITION(hashed_process_data->height)); hashed_process_data->x.middle_marked = TRUE; } /* jump */ @@ -1029,8 +1037,8 @@ int before_execmode_hook(void *hook_data, void *call_data) int before_process_exit_hook(void *hook_data, void *call_data) { - LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; - EventsRequest *events_request = (EventsRequest*)thf->hook_data; + LttvTraceHook *th = (LttvTraceHook*)hook_data; + EventsRequest *events_request = (EventsRequest*)th->hook_data; ControlFlowData *control_flow_data = events_request->viewer_data; @@ -1043,11 +1051,18 @@ int before_process_exit_hook(void *hook_data, void *call_data) LttEvent *e; e = ltt_tracefile_get_event(tfc->tf); + LttvFilter *filter = control_flow_data->filter; + if(filter != NULL && filter->head != NULL) + if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc,NULL,NULL)) + return FALSE; + LttTime evtime = ltt_event_time(e); /* Add process to process list (if not present) */ //LttvProcessState *process = tfs->process; - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; + guint trace_num = ts->parent.index; LttvProcessState *process = ts->running_process[cpu]; guint pid = process->pid; LttTime birth; @@ -1060,14 +1075,14 @@ int before_process_exit_hook(void *hook_data, void *call_data) birth = process->creation_time; - if(likely(process_list->current_hash_data[cpu] != NULL)) { - hashed_process_data = process_list->current_hash_data[cpu]; + if(likely(process_list->current_hash_data[trace_num][cpu] != NULL)) { + hashed_process_data = process_list->current_hash_data[trace_num][cpu]; } else { hashed_process_data = processlist_get_process_data(process_list, pid, process->cpu, &birth, - tfc->t_context->index); + trace_num); if(unlikely(hashed_process_data == NULL)) { g_assert(pid == 0 || pid != process->ppid); @@ -1077,11 +1092,13 @@ int before_process_exit_hook(void *hook_data, void *call_data) processlist_add(process_list, drawing, pid, + process->tgid, process->cpu, process->ppid, &birth, - tfc->t_context->index, + trace_num, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -1106,7 +1123,7 @@ int before_process_exit_hook(void *hook_data, void *call_data) #ifdef EXTRA_CHECK if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1) - return; + return FALSE; #endif //EXTRA_CHECK Drawing_t *drawing = control_flow_data->drawing; guint width = drawing->width; @@ -1122,7 +1139,7 @@ int before_process_exit_hook(void *hook_data, void *call_data) gdk_draw_point(hashed_process_data->pixmap, drawing->gc, x, - (hashed_process_data->height/2)-3); + COLLISION_POSITION(hashed_process_data->height)); hashed_process_data->x.middle_marked = TRUE; } } else { @@ -1132,7 +1149,7 @@ int before_process_exit_hook(void *hook_data, void *call_data) #ifdef EXTRA_CHECK if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1) - return; + return FALSE; #endif //EXTRA_CHECK Drawing_t *drawing = control_flow_data->drawing; guint width = drawing->width; @@ -1155,7 +1172,7 @@ int before_process_exit_hook(void *hook_data, void *call_data) gdk_draw_point(hashed_process_data->pixmap, drawing->gc, x, - (hashed_process_data->height/2)-3); + COLLISION_POSITION(hashed_process_data->height)); hashed_process_data->x.middle_marked = TRUE; } /* jump */ @@ -1218,8 +1235,8 @@ int before_process_exit_hook(void *hook_data, void *call_data) int before_process_release_hook(void *hook_data, void *call_data) { - LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; - EventsRequest *events_request = (EventsRequest*)thf->hook_data; + LttvTraceHook *th = (LttvTraceHook*)hook_data; + EventsRequest *events_request = (EventsRequest*)th->hook_data; ControlFlowData *control_flow_data = events_request->viewer_data; @@ -1232,12 +1249,19 @@ int before_process_release_hook(void *hook_data, void *call_data) LttEvent *e; e = ltt_tracefile_get_event(tfc->tf); + LttvFilter *filter = control_flow_data->filter; + if(filter != NULL && filter->head != NULL) + if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc,NULL,NULL)) + return FALSE; + LttTime evtime = ltt_event_time(e); + guint trace_num = ts->parent.index; guint pid; { - pid = ltt_event_get_long_unsigned(e, thf->f1); + pid = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); } /* Add process to process list (if not present) */ @@ -1261,29 +1285,13 @@ int before_process_release_hook(void *hook_data, void *call_data) pid, process->cpu, &birth, - tfc->t_context->index); + trace_num); if(unlikely(hashed_process_data == NULL)) - { - g_assert(pid == 0 || pid != process->ppid); - /* Process not present */ - Drawing_t *drawing = control_flow_data->drawing; - ProcessInfo *process_info; - processlist_add(process_list, - drawing, - pid, - process->cpu, - process->ppid, - &birth, - tfc->t_context->index, - process->name, - &pl_height, - &process_info, - &hashed_process_data); - gtk_widget_set_size_request(drawing->drawing_area, - -1, - pl_height); - gtk_widget_queue_draw(drawing->drawing_area); - } + /* + * Process already been scheduled out EXIT_DEAD, not in the process list + * anymore. Just return. + */ + return FALSE; /* Now, the process is in the state hash and our own process hash. * We definitely can draw the items related to the ending state. @@ -1299,7 +1307,7 @@ int before_process_release_hook(void *hook_data, void *call_data) #ifdef EXTRA_CHECK if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1) - return; + return FALSE; #endif //EXTRA_CHECK Drawing_t *drawing = control_flow_data->drawing; guint width = drawing->width; @@ -1315,7 +1323,7 @@ int before_process_release_hook(void *hook_data, void *call_data) gdk_draw_point(hashed_process_data->pixmap, drawing->gc, x, - (hashed_process_data->height/2)-3); + COLLISION_POSITION(hashed_process_data->height)); hashed_process_data->x.middle_marked = TRUE; } } else { @@ -1325,7 +1333,7 @@ int before_process_release_hook(void *hook_data, void *call_data) #ifdef EXTRA_CHECK if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1) - return; + return FALSE; #endif //EXTRA_CHECK Drawing_t *drawing = control_flow_data->drawing; guint width = drawing->width; @@ -1348,7 +1356,7 @@ int before_process_release_hook(void *hook_data, void *call_data) gdk_draw_point(hashed_process_data->pixmap, drawing->gc, x, - (hashed_process_data->height/2)-3); + COLLISION_POSITION(hashed_process_data->height)); hashed_process_data->x.middle_marked = TRUE; } /* jump */ @@ -1412,8 +1420,8 @@ int before_process_release_hook(void *hook_data, void *call_data) */ int after_process_fork_hook(void *hook_data, void *call_data) { - LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; - EventsRequest *events_request = (EventsRequest*)thf->hook_data; + LttvTraceHook *th = (LttvTraceHook*)hook_data; + EventsRequest *events_request = (EventsRequest*)th->hook_data; ControlFlowData *control_flow_data = events_request->viewer_data; LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; @@ -1425,11 +1433,17 @@ int after_process_fork_hook(void *hook_data, void *call_data) LttEvent *e; e = ltt_tracefile_get_event(tfc->tf); + LttvFilter *filter = control_flow_data->filter; + if(filter != NULL && filter->head != NULL) + if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc,NULL,NULL)) + return FALSE; + LttTime evtime = ltt_event_time(e); guint child_pid; { - child_pid = ltt_event_get_long_unsigned(e, thf->f2); + child_pid = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1)); } /* Add process to process list (if not present) */ @@ -1446,6 +1460,7 @@ int after_process_fork_hook(void *hook_data, void *call_data) g_assert(process_child != NULL); birth = process_child->creation_time; + guint trace_num = ts->parent.index; /* Cannot use current process, because this action is done by the parent * on its child. */ @@ -1453,7 +1468,7 @@ int after_process_fork_hook(void *hook_data, void *call_data) child_pid, process_child->cpu, &birth, - tfc->t_context->index); + trace_num); if(likely(hashed_process_data_child == NULL)) { g_assert(child_pid == 0 || child_pid != process_child->ppid); @@ -1463,11 +1478,13 @@ int after_process_fork_hook(void *hook_data, void *call_data) processlist_add(process_list, drawing, child_pid, + process_child->tgid, process_child->cpu, process_child->ppid, &birth, - tfc->t_context->index, + trace_num, process_child->name, + process_child->brand, &pl_height, &process_info, &hashed_process_data_child); @@ -1475,6 +1492,11 @@ int after_process_fork_hook(void *hook_data, void *call_data) -1, pl_height); gtk_widget_queue_draw(drawing->drawing_area); + } else { + processlist_set_ppid(process_list, process_child->ppid, + hashed_process_data_child); + processlist_set_tgid(process_list, process_child->tgid, + hashed_process_data_child); } @@ -1487,7 +1509,7 @@ int after_process_fork_hook(void *hook_data, void *call_data) #ifdef EXTRA_CHECK if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1) - return; + return FALSE; #endif //EXTRA_CHECK Drawing_t *drawing = control_flow_data->drawing; guint width = drawing->width; @@ -1514,7 +1536,7 @@ int after_process_fork_hook(void *hook_data, void *call_data) hashed_process_data_child->x.under_marked = FALSE; } } - return 0; + return FALSE; } @@ -1532,8 +1554,8 @@ int after_process_fork_hook(void *hook_data, void *call_data) */ int after_process_exit_hook(void *hook_data, void *call_data) { - LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; - EventsRequest *events_request = (EventsRequest*)thf->hook_data; + LttvTraceHook *th = (LttvTraceHook*)hook_data; + EventsRequest *events_request = (EventsRequest*)th->hook_data; ControlFlowData *control_flow_data = events_request->viewer_data; LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; @@ -1545,11 +1567,18 @@ int after_process_exit_hook(void *hook_data, void *call_data) LttEvent *e; e = ltt_tracefile_get_event(tfc->tf); + LttvFilter *filter = control_flow_data->filter; + if(filter != NULL && filter->head != NULL) + if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc,NULL,NULL)) + return FALSE; + LttTime evtime = ltt_event_time(e); /* Add process to process list (if not present) */ //LttvProcessState *process = tfs->process; - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; + guint trace_num = ts->parent.index; LttvProcessState *process = ts->running_process[cpu]; /* It should exist, because we are after the state update. */ @@ -1564,14 +1593,14 @@ int after_process_exit_hook(void *hook_data, void *call_data) birth = process->creation_time; - if(likely(process_list->current_hash_data[cpu] != NULL) ){ - hashed_process_data = process_list->current_hash_data[cpu]; + if(likely(process_list->current_hash_data[trace_num][cpu] != NULL) ){ + hashed_process_data = process_list->current_hash_data[trace_num][cpu]; } else { hashed_process_data = processlist_get_process_data(process_list, pid, process->cpu, &birth, - tfc->t_context->index); + trace_num); if(unlikely(hashed_process_data == NULL)) { g_assert(pid == 0 || pid != process->ppid); @@ -1581,11 +1610,13 @@ int after_process_exit_hook(void *hook_data, void *call_data) processlist_add(process_list, drawing, pid, + process->tgid, process->cpu, process->ppid, &birth, - tfc->t_context->index, + trace_num, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -1596,7 +1627,7 @@ int after_process_exit_hook(void *hook_data, void *call_data) } /* Set the current process */ - process_list->current_hash_data[process->cpu] = + process_list->current_hash_data[trace_num][process->cpu] = hashed_process_data; } @@ -1609,7 +1640,7 @@ int after_process_exit_hook(void *hook_data, void *call_data) #ifdef EXTRA_CHECK if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1) - return; + return FALSE; #endif //EXTRA_CHECK Drawing_t *drawing = control_flow_data->drawing; guint width = drawing->width; @@ -1626,15 +1657,15 @@ int after_process_exit_hook(void *hook_data, void *call_data) } } - return 0; + return FALSE; } /* Get the filename of the process to print */ int after_fs_exec_hook(void *hook_data, void *call_data) { - LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; - EventsRequest *events_request = (EventsRequest*)thf->hook_data; + LttvTraceHook *th = (LttvTraceHook*)hook_data; + EventsRequest *events_request = (EventsRequest*)th->hook_data; ControlFlowData *control_flow_data = events_request->viewer_data; LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; @@ -1643,7 +1674,17 @@ int after_fs_exec_hook(void *hook_data, void *call_data) LttvTraceState *ts = (LttvTraceState *)tfc->t_context; - guint cpu = ltt_tracefile_num(tfc->tf); + LttEvent *e; + e = ltt_tracefile_get_event(tfc->tf); + + LttvFilter *filter = control_flow_data->filter; + if(filter != NULL && filter->head != NULL) + if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc,NULL,NULL)) + return FALSE; + + guint cpu = tfs->cpu; + guint trace_num = ts->parent.index; LttvProcessState *process = ts->running_process[cpu]; g_assert(process != NULL); @@ -1658,14 +1699,14 @@ int after_fs_exec_hook(void *hook_data, void *call_data) ProcessList *process_list = control_flow_data->process_list; LttTime birth = process->creation_time; - if(likely(process_list->current_hash_data[cpu] != NULL)) { - hashed_process_data = process_list->current_hash_data[cpu]; + if(likely(process_list->current_hash_data[trace_num][cpu] != NULL)) { + hashed_process_data = process_list->current_hash_data[trace_num][cpu]; } else { hashed_process_data = processlist_get_process_data(process_list, pid, process->cpu, &birth, - tfc->t_context->index); + trace_num); if(unlikely(hashed_process_data == NULL)) { g_assert(pid == 0 || pid != process->ppid); @@ -1675,11 +1716,13 @@ int after_fs_exec_hook(void *hook_data, void *call_data) processlist_add(process_list, drawing, pid, + process->tgid, process->cpu, process->ppid, &birth, - tfc->t_context->index, + trace_num, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -1689,7 +1732,7 @@ int after_fs_exec_hook(void *hook_data, void *call_data) gtk_widget_queue_draw(drawing->drawing_area); } /* Set the current process */ - process_list->current_hash_data[process->cpu] = + process_list->current_hash_data[trace_num][process->cpu] = hashed_process_data; } @@ -1699,7 +1742,200 @@ int after_fs_exec_hook(void *hook_data, void *call_data) } +/* Get the filename of the process to print */ +int after_user_generic_thread_brand_hook(void *hook_data, void *call_data) +{ + LttvTraceHook *th = (LttvTraceHook*)hook_data; + EventsRequest *events_request = (EventsRequest*)th->hook_data; + ControlFlowData *control_flow_data = events_request->viewer_data; + + LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; + + LttvTracefileState *tfs = (LttvTracefileState *)call_data; + + LttvTraceState *ts = (LttvTraceState *)tfc->t_context; + LttEvent *e; + e = ltt_tracefile_get_event(tfc->tf); + + LttvFilter *filter = control_flow_data->filter; + if(filter != NULL && filter->head != NULL) + if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc,NULL,NULL)) + return FALSE; + + guint cpu = tfs->cpu; + guint trace_num = ts->parent.index; + LttvProcessState *process = ts->running_process[cpu]; + g_assert(process != NULL); + + guint pid = process->pid; + + /* Well, the process_out existed : we must get it in the process hash + * or add it, and draw its items. + */ + /* Add process to process list (if not present) */ + guint pl_height = 0; + HashedProcessData *hashed_process_data = NULL; + ProcessList *process_list = control_flow_data->process_list; + LttTime birth = process->creation_time; + + if(likely(process_list->current_hash_data[trace_num][cpu] != NULL)) { + hashed_process_data = process_list->current_hash_data[trace_num][cpu]; + } else { + hashed_process_data = processlist_get_process_data(process_list, + pid, + process->cpu, + &birth, + trace_num); + if(unlikely(hashed_process_data == NULL)) + { + g_assert(pid == 0 || pid != process->ppid); + ProcessInfo *process_info; + /* Process not present */ + Drawing_t *drawing = control_flow_data->drawing; + processlist_add(process_list, + drawing, + pid, + process->tgid, + process->cpu, + process->ppid, + &birth, + trace_num, + process->name, + process->brand, + &pl_height, + &process_info, + &hashed_process_data); + gtk_widget_set_size_request(drawing->drawing_area, + -1, + pl_height); + gtk_widget_queue_draw(drawing->drawing_area); + } + /* Set the current process */ + process_list->current_hash_data[trace_num][process->cpu] = + hashed_process_data; + } + + processlist_set_brand(process_list, process->brand, hashed_process_data); + + return 0; + +} + + +/* after_event_enum_process_hook + * + * Create the processlist entry for the child process. Put the last + * position in x at the current time value. + * + * @param hook_data ControlFlowData structure of the viewer. + * @param call_data Event context. + * + * This function adds items to be drawn in a queue for each process. + * + */ +int after_event_enum_process_hook(void *hook_data, void *call_data) +{ + LttvTraceHook *th = (LttvTraceHook*)hook_data; + EventsRequest *events_request = (EventsRequest*)th->hook_data; + ControlFlowData *control_flow_data = events_request->viewer_data; + + LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; + + LttvTracefileState *tfs = (LttvTracefileState *)call_data; + + LttvTraceState *ts = (LttvTraceState *)tfc->t_context; + + guint first_cpu, nb_cpus, cpu; + + LttEvent *e; + e = ltt_tracefile_get_event(tfc->tf); + + LttvFilter *filter = control_flow_data->filter; + if(filter != NULL && filter->head != NULL) + if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc,NULL,NULL)) + return FALSE; + + LttTime evtime = ltt_event_time(e); + + /* Add process to process list (if not present) */ + LttvProcessState *process_in; + LttTime birth; + guint pl_height = 0; + HashedProcessData *hashed_process_data_in = NULL; + + ProcessList *process_list = control_flow_data->process_list; + guint trace_num = ts->parent.index; + + guint pid_in; + { + pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); + } + + if(pid_in == 0) { + first_cpu = 0; + nb_cpus = ltt_trace_get_num_cpu(ts->parent.t); + } else { + first_cpu = ANY_CPU; + nb_cpus = ANY_CPU+1; + } + + for(cpu = first_cpu; cpu < nb_cpus; cpu++) { + /* Find process pid_in in the list... */ + process_in = lttv_state_find_process(ts, cpu, pid_in); + //process_in = tfs->process; + //guint cpu = tfs->cpu; + //guint trace_num = ts->parent.index; + //process_in = ts->running_process[cpu]; + /* It should exist, because we are after the state update. */ + #ifdef EXTRA_CHECK + //g_assert(process_in != NULL); + #endif //EXTRA_CHECK + birth = process_in->creation_time; + + hashed_process_data_in = processlist_get_process_data(process_list, + pid_in, + process_in->cpu, + &birth, + trace_num); + if(hashed_process_data_in == NULL) + { + if(pid_in != 0 && pid_in == process_in->ppid) + g_critical("TEST %u , %u", pid_in, process_in->ppid); + g_assert(pid_in == 0 || pid_in != process_in->ppid); + ProcessInfo *process_info; + Drawing_t *drawing = control_flow_data->drawing; + /* Process not present */ + processlist_add(process_list, + drawing, + pid_in, + process_in->tgid, + process_in->cpu, + process_in->ppid, + &birth, + trace_num, + process_in->name, + process_in->brand, + &pl_height, + &process_info, + &hashed_process_data_in); + gtk_widget_set_size_request(drawing->drawing_area, + -1, + pl_height); + gtk_widget_queue_draw(drawing->drawing_area); + } else { + processlist_set_name(process_list, process_in->name, + hashed_process_data_in); + processlist_set_ppid(process_list, process_in->ppid, + hashed_process_data_in); + processlist_set_tgid(process_list, process_in->tgid, + hashed_process_data_in); + } + } + return 0; +} gint update_time_window_hook(void *hook_data, void *call_data) @@ -1914,8 +2150,10 @@ gint update_time_window_hook(void *hook_data, void *call_data) control_flow_data->drawing->height); } + /* Update directly when scrolling */ + gdk_window_process_updates(control_flow_data->drawing->drawing_area->window, + TRUE); - return 0; } @@ -1924,6 +2162,12 @@ gint traceset_notify(void *hook_data, void *call_data) ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; Drawing_t *drawing = control_flow_data->drawing; + if(unlikely(drawing->gc == NULL)) { + return FALSE; + } + if(drawing->dotted_gc == NULL) { + return FALSE; + } drawing_clear(control_flow_data->drawing); processlist_clear(control_flow_data->process_list); @@ -2076,8 +2320,11 @@ gint update_current_time_hook(void *hook_data, void *call_data) } gtk_widget_queue_draw(control_flow_data->drawing->drawing_area); - + /* Update directly when scrolling */ + gdk_window_process_updates(control_flow_data->drawing->drawing_area->window, + TRUE); + return 0; } @@ -2103,6 +2350,8 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data) LttTime evtime = closure_data->end_time; + gboolean dodraw = TRUE; + { /* For the process */ /* First, check if the current process is in the state computation @@ -2124,7 +2373,7 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data) for(i=0;itracefiles->len;i++) { tfc = g_array_index(tc->tracefiles, LttvTracefileContext*, i); if(ltt_tracefile_name(tfc->tf) == LTT_NAME_CPU - && ltt_tracefile_num(tfc->tf) == process_info->cpu) + && tfs->cpu == process_info->cpu) break; } @@ -2141,6 +2390,12 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data) if(unlikely(process != NULL)) { + LttvFilter *filter = control_flow_data->filter; + if(filter != NULL && filter->head != NULL) + if(!lttv_filter_tree_parse(filter->head,NULL,NULL, + tc->t,NULL,process,tc)) + dodraw = FALSE; + /* Only draw for processes that are currently in the trace states */ ProcessList *process_list = control_flow_data->process_list; @@ -2222,8 +2477,10 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data) } else { draw_context.drawinfo.start.x = hashed_process_data->x.middle; /* Draw the line */ - PropertiesLine prop_line = prepare_s_e_line(process); - draw_line((void*)&prop_line, (void*)&draw_context); + if(dodraw) { + PropertiesLine prop_line = prepare_s_e_line(process); + draw_line((void*)&prop_line, (void*)&draw_context); + } /* become the last x position */ if(likely(x != hashed_process_data->x.middle)) { @@ -2328,10 +2585,19 @@ int after_chunk(void *hook_data, void *call_data) LttTime end_time; ProcessList *process_list = control_flow_data->process_list; + guint i; + LttvTraceset *traceset = tsc->ts; + guint nb_trace = lttv_traceset_number(traceset); + + /* Only execute when called for the first trace's events request */ + if(!process_list->current_hash_data) return; + for(i = 0 ; i < nb_trace ; i++) { + g_free(process_list->current_hash_data[i]); + } g_free(process_list->current_hash_data); process_list->current_hash_data = NULL; - + if(tfc != NULL) end_time = LTT_TIME_MIN(tfc->timestamp, events_request->end_time); else /* end of traceset, or position now out of request : end */ @@ -2371,3 +2637,70 @@ int after_chunk(void *hook_data, void *call_data) return 0; } +/* after_statedump_end + * + * @param hook_data ControlFlowData structure of the viewer. + * @param call_data Event context. + * + * This function adds items to be drawn in a queue for each process. + * + */ +int before_statedump_end(void *hook_data, void *call_data) +{ + LttvTraceHook *th = (LttvTraceHook*)hook_data; + EventsRequest *events_request = (EventsRequest*)th->hook_data; + ControlFlowData *control_flow_data = events_request->viewer_data; + + LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; + + LttvTracefileState *tfs = (LttvTracefileState *)call_data; + + LttvTraceState *ts = (LttvTraceState *)tfc->t_context; + + LttvTracesetState *tss = (LttvTracesetState*)tfc->t_context->ts_context; + ProcessList *process_list = control_flow_data->process_list; + + LttEvent *e; + e = ltt_tracefile_get_event(tfc->tf); + + LttvFilter *filter = control_flow_data->filter; + if(filter != NULL && filter->head != NULL) + if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc,NULL,NULL)) + return FALSE; + + LttTime evtime = ltt_event_time(e); + + ClosureData closure_data; + closure_data.events_request = events_request; + closure_data.tss = tss; + closure_data.end_time = evtime; + + TimeWindow time_window = + lttvwindow_get_time_window(control_flow_data->tab); + guint width = control_flow_data->drawing->width; + convert_time_to_pixels( + time_window, + evtime, + width, + &closure_data.x_end); + + /* Draw last items */ + g_hash_table_foreach(process_list->process_hash, draw_closure, + (void*)&closure_data); +#if 0 + /* Reactivate sort */ + gtk_tree_sortable_set_sort_column_id( + GTK_TREE_SORTABLE(control_flow_data->process_list->list_store), + GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, + GTK_SORT_ASCENDING); + + update_index_to_pixmap(control_flow_data->process_list); + /* Request a full expose : drawing scrambled */ + gtk_widget_queue_draw(control_flow_data->drawing->drawing_area); +#endif //0 + /* Request expose (updates damages zone also) */ + drawing_request_expose(events_request, tss, evtime); + + return 0; +}