From: compudj Date: Fri, 23 Jun 2006 22:29:33 +0000 (+0000) Subject: filtering by pid in cfv X-Git-Tag: v0.12.20~1524 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e38d9ea05da26962532573de017dd2e1893683ca;p=lttv.git filtering by pid in cfv git-svn-id: http://ltt.polymtl.ca/svn@1965 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index b7c7556f..26a0b7cf 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -1836,7 +1836,8 @@ static gboolean enum_process_state(void *hook_data, void *call_data) /* PID */ pid = ltt_event_get_unsigned(e, thf->f1); - + s->parent.target_pid = pid; + /* Parent PID */ parent_pid = ltt_event_get_unsigned(e, thf->f2); diff --git a/ltt/branches/poly/lttv/lttv/state.h b/ltt/branches/poly/lttv/lttv/state.h index c97c6c15..f53fee85 100644 --- a/ltt/branches/poly/lttv/lttv/state.h +++ b/ltt/branches/poly/lttv/lttv/state.h @@ -344,7 +344,7 @@ static inline guint lttv_state_get_target_pid(LttvTracefileState *tfs) guint cpu = tfs->cpu; LttvProcessState *process = ts->running_process[cpu]; - if(tfs->parent.target_pid) return tfs->parent.target_pid; + if(tfs->parent.target_pid >= 0) return tfs->parent.target_pid; else return process->pid; } diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index c800b924..ed7272a7 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -171,7 +171,7 @@ static void init_tracefile_context(LttTracefile *tracefile, tfc->event = lttv_hooks_new(); tfc->event_by_id = lttv_hooks_by_id_new(); tfc->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); - tfc->target_pid = 0; + tfc->target_pid = -1; } @@ -768,7 +768,7 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self, fac_id = ltt_event_facility_id(e); ev_id = ltt_event_eventtype_id(e); id = GET_HOOK_ID(fac_id, ev_id); - tfc->target_pid = 0; /* unset target PID */ + tfc->target_pid = -1; /* unset target PID */ /* Hooks : * return values : 0 : continue read, 1 : go to next position and stop read, * 2 : stay at the current position and stop read */ diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.h b/ltt/branches/poly/lttv/lttv/tracecontext.h index db4e5303..fcfef98b 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.h +++ b/ltt/branches/poly/lttv/lttv/tracecontext.h @@ -175,8 +175,8 @@ struct _LttvTracefileContext { LttvHooksById *event_by_id; LttTime timestamp; LttvAttribute *a; - guint target_pid; /* Target PID of the event. - Updated by state.c. 0 means unset. */ + gint target_pid; /* Target PID of the event. + Updated by state.c. -1 means unset. */ }; struct _LttvTracefileContextClass { diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index 7e2cc1d0..767cc213 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -345,8 +345,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 @@ -360,7 +362,10 @@ int before_schedchange_hook(void *hook_data, void *call_data) pid_in = ltt_event_get_long_unsigned(e, thf->f2); } - { + tfc->target_pid = pid_out; + if(!filter || !filter->head || + lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc)) { /* 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 @@ -521,7 +526,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)) { /* 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 @@ -683,6 +691,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) } else g_warning("Cannot find pin_in in schedchange %u", pid_in); } + tfc->target_pid = target_pid_saved; return 0; @@ -735,6 +744,12 @@ 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; + if(filter != NULL && filter->head != NULL) + if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, + tfc->t_context->t,tfc)) + return FALSE; + LttTime evtime = ltt_event_time(e); /* Add process to process list (if not present) */ @@ -863,6 +878,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)) + return FALSE; + LttTime evtime = ltt_event_time(e); /* we are in a execmode, before the state update. We must draw the @@ -1060,6 +1081,12 @@ 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)) + return FALSE; + LttTime evtime = ltt_event_time(e); /* Add process to process list (if not present) */ @@ -1251,6 +1278,12 @@ 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)) + return FALSE; + LttTime evtime = ltt_event_time(e); @@ -1446,6 +1479,12 @@ 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)) + return FALSE; + LttTime evtime = ltt_event_time(e); guint child_pid; @@ -1573,6 +1612,12 @@ 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)) + return FALSE; + LttTime evtime = ltt_event_time(e); /* Add process to process list (if not present) */ @@ -1673,6 +1718,15 @@ int after_fs_exec_hook(void *hook_data, void *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)) + return FALSE; + guint cpu = tfs->cpu; LttvProcessState *process = ts->running_process[cpu]; g_assert(process != NULL); @@ -1744,6 +1798,15 @@ int after_user_generic_thread_brand_hook(void *hook_data, void *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)) + return FALSE; + guint cpu = tfs->cpu; LttvProcessState *process = ts->running_process[cpu]; g_assert(process != NULL); @@ -1829,6 +1892,12 @@ int after_event_enum_process_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)) + return FALSE; + LttTime evtime = ltt_event_time(e); /* Add process to process list (if not present) */