X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Fcontrolflow%2Feventhooks.c;h=54eba010749b14d1b0f96df1f0defae0d1813cab;hb=f0d243f7b3a3fd1f5fe74f9f272213192dc9cdaa;hp=c79b0a4bbb81529bd0142b7f57c3b0fc04635011;hpb=1fc7847f7f1d2f79b4dabc275c7c809990720ffc;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 c79b0a4b..54eba010 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -363,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,11 +394,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, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -524,7 +526,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 @@ -538,7 +540,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) @@ -550,11 +552,13 @@ int before_schedchange_hook(void *hook_data, void *call_data) processlist_add(process_list, drawing, pid_in, - ltt_tracefile_num(tfc->tf), + process->tgid, + tfs->cpu, process->ppid, &birth, tfc->t_context->index, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -748,7 +752,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,11 +774,13 @@ int after_schedchange_hook(void *hook_data, void *call_data) processlist_add(process_list, drawing, pid_in, + process_in->tgid, 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); @@ -861,7 +867,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,11 +899,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, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -1052,7 +1060,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,11 +1090,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, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -1276,11 +1286,13 @@ int before_process_release_hook(void *hook_data, void *call_data) processlist_add(process_list, drawing, pid, + process->tgid, process->cpu, process->ppid, &birth, tfc->t_context->index, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -1468,11 +1480,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, process_child->name, + process_child->brand, &pl_height, &process_info, &hashed_process_data_child); @@ -1480,6 +1494,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); } @@ -1554,7 +1573,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,11 +1605,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, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -1648,7 +1669,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,11 +1701,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, process->name, + process->brand, &pl_height, &process_info, &hashed_process_data); @@ -1704,6 +1727,78 @@ 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->tgid, + 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 @@ -1749,7 +1844,7 @@ int after_event_enum_process_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 @@ -1773,11 +1868,13 @@ int after_event_enum_process_hook(void *hook_data, void *call_data) processlist_add(process_list, drawing, pid_in, + process_in->tgid, 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); @@ -1786,10 +1883,12 @@ int after_event_enum_process_hook(void *hook_data, void *call_data) 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_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; } @@ -2228,7 +2327,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; }