filtering by pid in cfv
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 23 Jun 2006 22:29:33 +0000 (22:29 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 23 Jun 2006 22:29:33 +0000 (22:29 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1965 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/state.c
ltt/branches/poly/lttv/lttv/state.h
ltt/branches/poly/lttv/lttv/tracecontext.c
ltt/branches/poly/lttv/lttv/tracecontext.h
ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c

index b7c7556f7ff6ace72fee37bb3c2345978b7f62bb..26a0b7cf0206683e15785836a11087f77539f820 100644 (file)
@@ -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);
 
index c97c6c15d4297b5a6b6c3618bc22183cf1231ff3..f53fee8565a67f5719a19abebff179a1858395bf 100644 (file)
@@ -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;
 }
 
index c800b924d1114c91be7fc564d7d29165a9d7a5f6..ed7272a75542767099bc010af55462051faf646d 100644 (file)
@@ -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 */
index db4e5303d2a95f2048691717c26758145372ae86..fcfef98b572f6bc681b9db704a71bf29e05c44f8 100644 (file)
@@ -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 {
index 7e2cc1d062479abb7bfd94b07a5cbf3bbd884e88..767cc2137b81a39ad1bcd46c56427f0c3bb72e7e 100644 (file)
@@ -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) */
This page took 0.03042 seconds and 4 git commands to generate.