X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Fcontrolflow%2Feventhooks.c;h=cc4a553be7d65ca49a047fc05e0755506730bee1;hb=8eddb7504fe51321ac56a0de6d5a82f7a94a5feb;hp=05e3f43e7f88836b24a3d8efc6bc54e46ef42b3a;hpb=93ac601b7487eba4b0733f44117f45fa9dd0baee;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 05e3f43e..cc4a553b 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -139,7 +139,8 @@ static void request_background_data(ControlFlowData *control_flow_data) * starts. */ if(!lttvwindowtraces_background_request_find(trace, "state")) - lttvwindowtraces_background_request_queue(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,7 +158,7 @@ static void request_background_data(ControlFlowData *control_flow_data) } } else { /* Data ready. Be its nature, this viewer doesn't need to have - * its data ready hook called htere, because a background + * its data ready hook called there, because a background * request is always linked with a redraw. */ } @@ -182,7 +183,7 @@ GtkWidget * h_guicontrolflow(Tab *tab) { g_info("h_guicontrolflow, %p", tab); - ControlFlowData *control_flow_data = guicontrolflow() ; + ControlFlowData *control_flow_data = guicontrolflow(tab) ; control_flow_data->tab = tab; @@ -278,6 +279,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 @@ -297,8 +300,10 @@ 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 { + g_critical("unknown state : %s", g_quark_to_string(process->state->s)); g_assert(FALSE); /* UNKNOWN STATE */ + } return prop_line; @@ -358,12 +363,12 @@ int before_schedchange_hook(void *hook_data, void *call_data) * 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; 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 @@ -394,6 +399,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) &birth, tfc->t_context->index, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -519,7 +525,7 @@ 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); if(process != NULL) { /* Well, the process existed : we must get it in the process hash @@ -533,7 +539,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) hashed_process_data = processlist_get_process_data(process_list, pid_in, - ltt_tracefile_num(tfc->tf), + tfs->cpu, &birth, tfc->t_context->index); if(hashed_process_data == NULL) @@ -545,11 +551,12 @@ int before_schedchange_hook(void *hook_data, void *call_data) processlist_add(process_list, drawing, pid_in, - ltt_tracefile_num(tfc->tf), + tfs->cpu, process->ppid, &birth, tfc->t_context->index, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -743,7 +750,7 @@ int after_schedchange_hook(void *hook_data, void *call_data) /* 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); + guint cpu = tfs->cpu; process_in = ts->running_process[cpu]; /* It should exist, because we are after the state update. */ #ifdef EXTRA_CHECK @@ -770,6 +777,7 @@ int after_schedchange_hook(void *hook_data, void *call_data) &birth, tfc->t_context->index, process_in->name, + process_in->brand, &pl_height, &process_info, &hashed_process_data_in); @@ -856,7 +864,7 @@ 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; LttvProcessState *process = ts->running_process[cpu]; g_assert(process != NULL); @@ -893,6 +901,7 @@ int before_execmode_hook(void *hook_data, void *call_data) &birth, tfc->t_context->index, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -1047,7 +1056,7 @@ int before_process_exit_hook(void *hook_data, void *call_data) /* Add process to process list (if not present) */ //LttvProcessState *process = tfs->process; - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; LttvProcessState *process = ts->running_process[cpu]; guint pid = process->pid; LttTime birth; @@ -1082,6 +1091,7 @@ int before_process_exit_hook(void *hook_data, void *call_data) &birth, tfc->t_context->index, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -1276,6 +1286,7 @@ int before_process_release_hook(void *hook_data, void *call_data) &birth, tfc->t_context->index, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -1468,6 +1479,7 @@ int after_process_fork_hook(void *hook_data, void *call_data) &birth, tfc->t_context->index, process_child->name, + process_child->brand, &pl_height, &process_info, &hashed_process_data_child); @@ -1549,7 +1561,7 @@ int after_process_exit_hook(void *hook_data, void *call_data) /* Add process to process list (if not present) */ //LttvProcessState *process = tfs->process; - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; LttvProcessState *process = ts->running_process[cpu]; /* It should exist, because we are after the state update. */ @@ -1586,6 +1598,7 @@ int after_process_exit_hook(void *hook_data, void *call_data) &birth, tfc->t_context->index, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -1643,7 +1656,7 @@ int after_fs_exec_hook(void *hook_data, void *call_data) LttvTraceState *ts = (LttvTraceState *)tfc->t_context; - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; LttvProcessState *process = ts->running_process[cpu]; g_assert(process != NULL); @@ -1680,6 +1693,7 @@ int after_fs_exec_hook(void *hook_data, void *call_data) &birth, tfc->t_context->index, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -1699,7 +1713,167 @@ 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) +{ + LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; + EventsRequest *events_request = (EventsRequest*)thf->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 cpu = tfs->cpu; + 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[cpu] != NULL)) { + hashed_process_data = process_list->current_hash_data[cpu]; + } else { + hashed_process_data = processlist_get_process_data(process_list, + pid, + process->cpu, + &birth, + tfc->t_context->index); + 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->cpu, + process->ppid, + &birth, + tfc->t_context->index, + 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[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) +{ + LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data; + EventsRequest *events_request = (EventsRequest*)thf->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); + + 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 pid_in; + { + pid_in = ltt_event_get_long_unsigned(e, thf->f1); + } + + + /* 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; + //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, + tfc->t_context->index); + 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->cpu, + process_in->ppid, + &birth, + tfc->t_context->index, + 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); + } + return 0; +} gint update_time_window_hook(void *hook_data, void *call_data) @@ -1914,8 +2088,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 +2100,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 +2258,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; } @@ -2124,7 +2309,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; }