X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Fmodules%2Fgui%2Fcontrolflow%2Feventhooks.c;h=854f1db61f71eba770466fc95653c997e71af0f9;hb=7b20eed1e2a33658249baf49488b6c93028639f9;hp=aae0f79c15580a6e497df7cb208e3212b9e125f7;hpb=88bf15f0f2a239186b5cf6fcf8711786907ca483;p=lttv.git diff --git a/lttv/modules/gui/controlflow/eventhooks.c b/lttv/modules/gui/controlflow/eventhooks.c index aae0f79c..854f1db6 100644 --- a/lttv/modules/gui/controlflow/eventhooks.c +++ b/lttv/modules/gui/controlflow/eventhooks.c @@ -287,40 +287,43 @@ static inline PropertiesLine prepare_s_e_line(LttvProcessState *process) int before_trywakeup_hook(void *hook_data, void *call_data) { -#ifdef BABEL_CLEANUP - LttvTraceHook *th = (LttvTraceHook*)hook_data; - EventsRequest *events_request = (EventsRequest*)th->hook_data; - ControlFlowData *control_flow_data = events_request->viewer_data; + LttvEvent *event; - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; + event = (LttvEvent *) call_data; + if (strcmp(lttv_traceset_get_name_from_event(event),"sched_wakeup") != 0) + return FALSE; - LttvTraceState *ts = (LttvTraceState *)tfc->t_context; + ControlFlowData *control_flow_data = (ControlFlowData*)hook_data; - LttEvent *e = ltt_tracefile_get_event(tfc->tf); - gint target_pid_saved = tfc->target_pid; + LttvTraceState *ts = event->state;; - LttTime evtime = ltt_event_time(e); + + LttTime evtime = lttv_event_get_timestamp(event); +#ifdef BABEL_CLEANUP LttvFilter *filter = control_flow_data->filter; +#endif guint woken_pid; gint woken_cpu; - woken_pid = ltt_event_get_int(e, lttv_trace_get_hook_field(th, 0)); - woken_cpu = ltt_event_get_unsigned(e, lttv_trace_get_hook_field(th, 1)); - - tfc->target_pid = woken_pid; + woken_pid = lttv_event_get_long(event, "tid"); + woken_cpu = lttv_event_get_long(event, "target_cpu"); + +#ifdef BABEL_CLEANUP if(!filter || !filter->head || lttv_filter_tree_parse(filter->head,e,tfc->tf, tfc->t_context->t,tfc,NULL,NULL)) { - +#else + { +#endif /* First, check if the woken 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. TOCHECK: What does that last para mean? */ - guint trace_num = ts->parent.index; - LttvProcessState *process = lttv_state_find_process(ts, woken_cpu, woken_pid); + guint trace_num = 0; /*TODO ybrosseau 2012-08-23: use right number */ + LttvProcessState *process = lttv_state_find_process(ts, woken_cpu, woken_pid); if(process != NULL) { /* Well, the woken process existed : we must get it in the process hash @@ -469,10 +472,10 @@ int before_trywakeup_hook(void *hook_data, void *call_data) } } - tfc->target_pid = target_pid_saved; + + return 0; -#endif //babel_cleanup } @@ -507,9 +510,9 @@ int before_schedchange_hook(void *hook_data, void *call_data) gint64 state_out; LttTime timestamp; event = (LttvEvent *) call_data; - if (strcmp(lttv_traceset_get_name_from_event(event), - "sched_switch") != 0) - return FALSE; + if (strcmp(lttv_traceset_get_name_from_event(event),"sched_switch") != 0) + return FALSE; + ControlFlowData *control_flow_data = (ControlFlowData*)hook_data; @@ -519,11 +522,13 @@ int before_schedchange_hook(void *hook_data, void *call_data) */ cpu = lttv_traceset_get_cpuid_from_event(event); ts = event->state; - process = ts->running_process[cpu]; + pid_out = lttv_event_get_long(event, "prev_tid"); pid_in = lttv_event_get_long(event, "next_tid"); state_out = lttv_event_get_long(event, "prev_state"); + guint trace_number = 0;//TODO fdeslauriers 2012-07-17: // Use trace handle to know trace number + process = lttv_state_find_process(ts,cpu,pid_out); timestamp = lttv_event_get_timestamp(event); /* For the pid_out */ /* First, check if the current process is in the state computation @@ -548,7 +553,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) pid_out, process->cpu, &birth, - 18);//TODO "use the right value or delete" + trace_number); if(hashed_process_data == NULL) { g_assert(pid_out == 0 || pid_out != process->ppid); @@ -562,7 +567,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) process->cpu, process->ppid, &birth, - 18,//TODO "use the right value or delete" + trace_number, process->name, process->brand, &pl_height, @@ -685,7 +690,7 @@ 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. */ - process = ts->running_process[cpu]; + process = lttv_state_find_process(ts,cpu,pid_in); if(process != NULL) { /* Well, the process existed : we must get it in the process hash @@ -701,7 +706,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) pid_in, cpu, &birth, - 18);//TODO "use the right value or delete" + trace_number);//TODO "use the right value or delete" if(hashed_process_data == NULL) { g_assert(pid_in == 0 || pid_in != process->ppid); @@ -715,7 +720,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) cpu, process->ppid, &birth, - 18, + trace_number, process->name, process->brand, &pl_height, @@ -879,22 +884,22 @@ int before_schedchange_hook(void *hook_data, void *call_data) */ int after_schedchange_hook(void *hook_data, void *call_data) { -#ifdef BABEL_CLEANUP - LttvTraceHook *th = (LttvTraceHook*)hook_data; - EventsRequest *events_request = (EventsRequest*)th->hook_data; - ControlFlowData *control_flow_data = events_request->viewer_data; + LttvEvent *event; - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; + event = (LttvEvent *) call_data; + + if (strcmp(lttv_traceset_get_name_from_event(event),"sched_switch") != 0) + return FALSE; - LttvTracefileState *tfs = (LttvTracefileState *)call_data; + ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; - LttvTraceState *ts = (LttvTraceState *)tfc->t_context; - LttEvent *e; - e = ltt_tracefile_get_event(tfc->tf); + LttvTraceState *ts = event->state; +#ifdef BABEL_CLEANUP LttvFilter *filter = control_flow_data->filter; - LttTime evtime = ltt_event_time(e); +#endif + LttTime evtime = lttv_event_get_timestamp(event); /* Add process to process list (if not present) */ LttvProcessState *process_in; @@ -906,18 +911,21 @@ int after_schedchange_hook(void *hook_data, void *call_data) guint pid_in; { - pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1)); + pid_in = lttv_event_get_long(event, "next_tid"); } - tfc->target_pid = pid_in; +#ifdef BABEL_CLEANUP if(!filter || !filter->head || lttv_filter_tree_parse(filter->head,e,tfc->tf, tfc->t_context->t,tfc,NULL,NULL)) { +#else + { +#endif /* 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; + guint cpu = lttv_traceset_get_cpuid_from_event(event); + guint trace_num = 0; /* TODO set right trace number */ process_in = ts->running_process[cpu]; /* It should exist, because we are after the state update. */ #ifdef EXTRA_CHECK @@ -988,7 +996,6 @@ int after_schedchange_hook(void *hook_data, void *call_data) } return 0; -#endif //babel_cleanup } @@ -1016,6 +1023,7 @@ int before_execmode_hook(void *hook_data, void *call_data) { LttvEvent *event; guint cpu; + guint pid = 0; LttvTraceState *ts; LttvProcessState *process; @@ -1025,9 +1033,11 @@ int before_execmode_hook(void *hook_data, void *call_data) */ event = (LttvEvent *) call_data; - if (strcmp(lttv_traceset_get_name_from_event(event), - "irq_handler_entry") != 0) - return FALSE; + if ((strncmp(lttv_traceset_get_name_from_event(event),"sys_", sizeof("sys_") - 1) == 0) + ||(strcmp(lttv_traceset_get_name_from_event(event),"exit_syscall") == 0) + ||(strncmp(lttv_traceset_get_name_from_event(event),"irq_handler_",sizeof("irq_handler_")) == 0) + ||(strncmp(lttv_traceset_get_name_from_event(event),"softirq_", sizeof("softirq_")) == 0)){ + LttTime evtime = lttv_event_get_timestamp(event); ControlFlowData *control_flow_data = (ControlFlowData*)hook_data; /* For the pid */ @@ -1037,7 +1047,7 @@ int before_execmode_hook(void *hook_data, void *call_data) ts = event->state; guint trace_number = 0;//TODO fdeslauriers 2012-07-17: // Use trace handle to know trace number - process = ts->running_process[cpu]; + process = lttv_state_find_process(ts ,cpu ,pid); g_assert(process != NULL); guint pid = process->pid; @@ -1197,7 +1207,7 @@ int before_execmode_hook(void *hook_data, void *call_data) &hashed_process_data->next_good_time); } } - + } return 0; } @@ -1215,33 +1225,33 @@ int before_execmode_hook(void *hook_data, void *call_data) int before_process_exit_hook(void *hook_data, void *call_data) { -#ifdef BABEL_CLEANUP - 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; + LttvEvent *event; - LttvTraceState *ts = (LttvTraceState *)tfc->t_context; + event = (LttvEvent *) call_data; + if (strcmp(lttv_traceset_get_name_from_event(event), + "sched_process_exit") != 0) + return FALSE; - LttEvent *e; - e = ltt_tracefile_get_event(tfc->tf); + + ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; + LttvTraceState *ts = event->state; +#ifdef BABEL_CLEANUP 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; +#endif - LttTime evtime = ltt_event_time(e); + LttTime evtime = lttv_event_get_timestamp(event); /* Add process to process list (if not present) */ //LttvProcessState *process = tfs->process; - guint cpu = tfs->cpu; - guint trace_num = ts->parent.index; + guint cpu = lttv_traceset_get_cpuid_from_event(event); + guint trace_num = 0; /* TODO set right trace number */ + LttvProcessState *process = ts->running_process[cpu]; guint pid = process->pid; LttTime birth; @@ -1393,9 +1403,8 @@ int before_process_exit_hook(void *hook_data, void *call_data) &hashed_process_data->next_good_time); } } - + return 0; -#endif //babel_cleanup } @@ -1415,32 +1424,34 @@ int before_process_exit_hook(void *hook_data, void *call_data) int before_process_release_hook(void *hook_data, void *call_data) { -#ifdef BABEL_CLEANUP - LttvTraceHook *th = (LttvTraceHook*)hook_data; - EventsRequest *events_request = (EventsRequest*)th->hook_data; - ControlFlowData *control_flow_data = events_request->viewer_data; + LttvEvent *event; - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; + event = (LttvEvent *) call_data; + + if (strcmp(lttv_traceset_get_name_from_event(event),"sched_process_free") != 0) + return FALSE; - LttvTraceState *ts = (LttvTraceState *)tfc->t_context; + ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; - LttEvent *e; - e = ltt_tracefile_get_event(tfc->tf); + LttvTraceState *ts = event->state; + +#ifdef BABEL_CLEANUP 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; +#endif + LttTime evtime = lttv_event_get_timestamp(event); - LttTime evtime = ltt_event_time(e); - guint trace_num = ts->parent.index; + guint trace_num = 0; /* TODO set right trace number */ guint pid; { - pid = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); + pid = lttv_event_get_long(event, "tid"); } /* Add process to process list (if not present) */ @@ -1579,7 +1590,6 @@ int before_process_release_hook(void *hook_data, void *call_data) } return 0; -#endif //babel_cleanup } @@ -1599,29 +1609,31 @@ int before_process_release_hook(void *hook_data, void *call_data) */ int after_process_fork_hook(void *hook_data, void *call_data) { -#ifdef BABEL_CLEANUP - LttvTraceHook *th = (LttvTraceHook*)hook_data; - EventsRequest *events_request = (EventsRequest*)th->hook_data; - ControlFlowData *control_flow_data = events_request->viewer_data; + LttvEvent *event; - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; + event = (LttvEvent *) call_data; + + if (strcmp(lttv_traceset_get_name_from_event(event),"sched_process_fork") != 0) + return FALSE; - LttvTraceState *ts = (LttvTraceState *)tfc->t_context; + ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; - LttEvent *e; - e = ltt_tracefile_get_event(tfc->tf); + LttvTraceState *ts = event->state; + +#ifdef BABEL_CLEANUP 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; +#endif - LttTime evtime = ltt_event_time(e); + LttTime evtime = lttv_event_get_timestamp(event); guint child_pid; { - child_pid = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1)); + child_pid = lttv_event_get_long(event, "child_tid"); } /* Add process to process list (if not present) */ @@ -1638,7 +1650,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; + guint trace_num = 0; /* TODO put right */ /* Cannot use current process, because this action is done by the parent * on its child. */ @@ -1715,7 +1727,6 @@ int after_process_fork_hook(void *hook_data, void *call_data) } } return FALSE; -#endif //babel_cleanup } @@ -1733,32 +1744,32 @@ int after_process_fork_hook(void *hook_data, void *call_data) */ int after_process_exit_hook(void *hook_data, void *call_data) { -#ifdef BABEL_CLEANUP - 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; +#if 0 + LttvEvent *event; - LttvTracefileState *tfs = (LttvTracefileState *)call_data; + event = (LttvEvent *) call_data; + + if (strcmp(lttv_traceset_get_name_from_event(event),"sched_process_exit") != 0) + return FALSE; - LttvTraceState *ts = (LttvTraceState *)tfc->t_context; + ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; - LttEvent *e; - e = ltt_tracefile_get_event(tfc->tf); + LttvTraceState *ts = event->state; +#ifdef BABEL_CLEANUP 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; +#endif - LttTime evtime = ltt_event_time(e); + LttTime evtime = lttv_event_get_timestamp(event); /* Add process to process list (if not present) */ //LttvProcessState *process = tfs->process; - guint cpu = tfs->cpu; - guint trace_num = ts->parent.index; + guint cpu = lttv_traceset_get_cpuid_from_event(event); + guint trace_num = 0; /* TODO set right trace number */ LttvProcessState *process = ts->running_process[cpu]; /* It should exist, because we are after the state update. */ @@ -1836,9 +1847,8 @@ int after_process_exit_hook(void *hook_data, void *call_data) hashed_process_data->x.middle_marked = FALSE; } } - +#endif return FALSE; -#endif //babel_cleanup } @@ -1920,8 +1930,8 @@ int after_fs_exec_hook(void *hook_data, void *call_data) processlist_set_name(process_list, process->name, hashed_process_data); - return 0; #endif //babel_cleanup + return 0; } @@ -2003,8 +2013,8 @@ int after_user_generic_thread_brand_hook(void *hook_data, void *call_data) processlist_set_brand(process_list, process->brand, hashed_process_data); - return 0; #endif //babel_cleanup + return 0; } @@ -2021,26 +2031,27 @@ int after_user_generic_thread_brand_hook(void *hook_data, void *call_data) */ int after_event_enum_process_hook(void *hook_data, void *call_data) { -#ifdef BABEL_CLEANUP - LttvTraceHook *th = (LttvTraceHook*)hook_data; - EventsRequest *events_request = (EventsRequest*)th->hook_data; - ControlFlowData *control_flow_data = events_request->viewer_data; + LttvEvent *event; - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; + event = (LttvEvent *) call_data; + + if (strcmp(lttv_traceset_get_name_from_event(event),"lttng_statedump_process_state") != 0) + return FALSE; - LttvTraceState *ts = (LttvTraceState *)tfc->t_context; + ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; - guint first_cpu, nb_cpus, cpu; - LttEvent *e; - e = ltt_tracefile_get_event(tfc->tf); + LttvTraceState *ts = event->state; + + guint first_cpu, nb_cpus, cpu; +#ifdef BABEL_CLEANUP 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; - +#endif /* Add process to process list (if not present) */ LttvProcessState *process_in; LttTime birth; @@ -2048,16 +2059,16 @@ int after_event_enum_process_hook(void *hook_data, void *call_data) HashedProcessData *hashed_process_data_in = NULL; ProcessList *process_list = control_flow_data->process_list; - guint trace_num = ts->parent.index; + guint trace_num = 0; /* TODO put right trace number */ guint pid_in; { - pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); + pid_in = lttv_event_get_long(event, "tid"); } if(pid_in == 0) { first_cpu = 0; - nb_cpus = ltt_trace_get_num_cpu(ts->parent.t); + nb_cpus = lttv_trace_get_num_cpu(ts->trace); } else { first_cpu = ANY_CPU; nb_cpus = ANY_CPU+1; @@ -2116,7 +2127,6 @@ int after_event_enum_process_hook(void *hook_data, void *call_data) } } return 0; -#endif //babel_cleanup } @@ -2823,27 +2833,31 @@ int after_chunk(void *hook_data, void *call_data) */ int before_statedump_end(void *hook_data, void *call_data) { -#ifdef BABEL_CLEANUP - LttvTraceHook *th = (LttvTraceHook*)hook_data; - EventsRequest *events_request = (EventsRequest*)th->hook_data; - ControlFlowData *control_flow_data = events_request->viewer_data; + LttvEvent *event; - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; + event = (LttvEvent *) call_data; + + if (strcmp(lttv_traceset_get_name_from_event(event),"lttng_statedump_end") != 0) + return FALSE; - LttvTracesetState *tss = (LttvTracesetState*)tfc->t_context->ts_context; - ProcessList *process_list = control_flow_data->process_list; + ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; + + + LttvTraceState *ts = event->state; - LttEvent *e; - e = ltt_tracefile_get_event(tfc->tf); + ProcessList *process_list = control_flow_data->process_list; + +#ifdef BABEL_CLEANUP 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; +#endif - LttTime evtime = ltt_event_time(e); - + LttTime evtime = lttv_event_get_timestamp(event); +#ifdef BABEL_CLEANUP ClosureData closure_data; closure_data.events_request = events_request; closure_data.tss = tss; @@ -2861,6 +2875,7 @@ int before_statedump_end(void *hook_data, void *call_data) /* 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( @@ -2874,7 +2889,6 @@ int before_statedump_end(void *hook_data, void *call_data) #endif //0 /* Request expose (updates damages zone also) */ drawing_request_expose(events_request, tss, evtime); - +#endif return 0; -#endif //babel_cleanup }