Update LTTV to trace format 2.3
[lttv.git] / trunk / lttv / lttv / lttv / stats.c
index cb09fd0d8a73ec86fde9de43ad90614b027cd085..6aef4403c61584d7ed869d70c6455cb917c695c8 100644 (file)
@@ -781,8 +781,6 @@ static gboolean every_event(void *hook_data, void *call_data)
 
   LttvAttributeValue v;
 
-  LttTrace *trace = ((LttvTracefileContext *)tfcs)->t_context->t;
-
   struct marker_info *info;
 
   /* The current branch corresponds to the tracefile/process/interrupt state.
@@ -790,7 +788,7 @@ static gboolean every_event(void *hook_data, void *call_data)
      type occuring in this context. A quark has been pre-allocated for each
      event type and is used as name. */
 
-  info = marker_get_info_from_id(trace, e->event_id);
+  info = marker_get_info_from_id(tfcs->parent.parent.tf->mdata, e->event_id);
 
   lttv_attribute_find(tfcs->current_event_types_tree, 
       info->name, LTTV_UINT, &v);
@@ -1068,77 +1066,77 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
     hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 12);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SYSCALL_ENTRY,
         FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
         before_syscall_entry, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SYSCALL_EXIT,
         NULL,
         before_syscall_exit, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_TRAP_ENTRY,
         FIELD_ARRAY(LTT_FIELD_TRAP_ID),
         before_trap_entry, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_TRAP_EXIT,
         NULL,
         before_trap_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_IRQ_ENTRY,
         FIELD_ARRAY(LTT_FIELD_IRQ_ID),
         before_irq_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_IRQ_EXIT,
         NULL,
         before_irq_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SOFT_IRQ_ENTRY,
         FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
         before_soft_irq_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SOFT_IRQ_EXIT,
         NULL,
         before_soft_irq_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SCHED_SCHEDULE,
         FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
         before_schedchange, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_USER_GENERIC,
+        LTT_CHANNEL_USERSPACE,
         LTT_EVENT_FUNCTION_ENTRY,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         before_function_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_USER_GENERIC,
+        LTT_CHANNEL_USERSPACE,
         LTT_EVENT_FUNCTION_EXIT,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         before_function_exit, NULL,
@@ -1146,7 +1144,7 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
 
     /* statedump-related hooks */
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_LIST,
+        LTT_CHANNEL_TASK_STATE,
         LTT_EVENT_PROCESS_STATE,
         FIELD_ARRAY(LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME),
         before_enum_process_state, NULL,
@@ -1157,98 +1155,98 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
     hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 16);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SYSCALL_ENTRY,
         FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
         after_syscall_entry, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SYSCALL_EXIT,
         NULL,
         after_syscall_exit, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_TRAP_ENTRY, 
         FIELD_ARRAY(LTT_FIELD_TRAP_ID),
         after_trap_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_TRAP_EXIT,
         NULL,
         after_trap_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_IRQ_ENTRY, 
         FIELD_ARRAY(LTT_FIELD_IRQ_ID),
         after_irq_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_IRQ_EXIT,
         NULL,
         after_irq_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SOFT_IRQ_ENTRY, 
         FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
         after_soft_irq_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SOFT_IRQ_EXIT,
         NULL,
         after_soft_irq_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SCHED_SCHEDULE,
         FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
         after_schedchange, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_PROCESS_FORK, 
         FIELD_ARRAY(LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID),
         process_fork, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_PROCESS_EXIT,
         FIELD_ARRAY(LTT_FIELD_PID),
         process_exit, NULL,
         &hooks);
     
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_PROCESS_FREE,
         FIELD_ARRAY(LTT_FIELD_PID),
         process_free, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_USER_GENERIC,
+        LTT_CHANNEL_USERSPACE,
         LTT_EVENT_FUNCTION_ENTRY,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         after_function_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_USER_GENERIC,
+        LTT_CHANNEL_USERSPACE,
         LTT_EVENT_FUNCTION_EXIT,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         after_function_exit, NULL,
@@ -1256,14 +1254,14 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
 
     /* statedump-related hooks */
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_LIST,
+        LTT_CHANNEL_TASK_STATE,
         LTT_EVENT_PROCESS_STATE,
         FIELD_ARRAY(LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME),
         after_enum_process_state, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_LIST,
+        LTT_CHANNEL_GLOBAL_STATE,
         LTT_EVENT_STATEDUMP_END,
         NULL,
         after_statedump_end, NULL,
@@ -1283,19 +1281,21 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
 
       for(k = 0 ; k < before_hooks->len ; k++) {
         th = &g_array_index(before_hooks, LttvTraceHook, k);
-        lttv_hooks_add(
-            lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
-            th->h,
-            th,
-            LTTV_PRIO_STATS_BEFORE_STATE);
+        if (th->mdata == tfs->parent.parent.tf->mdata)
+          lttv_hooks_add(
+              lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
+              th->h,
+              th,
+              LTTV_PRIO_STATS_BEFORE_STATE);
       }
       for(k = 0 ; k < after_hooks->len ; k++) {
         th = &g_array_index(after_hooks, LttvTraceHook, k);
-        lttv_hooks_add(
-            lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
-            th->h,
-            th,
-            LTTV_PRIO_STATS_AFTER_STATE);
+        if (th->mdata == tfs->parent.parent.tf->mdata)
+          lttv_hooks_add(
+              lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
+              th->h,
+              th,
+              LTTV_PRIO_STATS_AFTER_STATE);
       }
     }
     lttv_attribute_find(self->parent.parent.a, LTTV_STATS_BEFORE_HOOKS, 
@@ -1355,17 +1355,19 @@ void lttv_stats_remove_event_hooks(LttvTracesetStats *self)
 
       for(k = 0 ; k < before_hooks->len ; k++) {
         th = &g_array_index(before_hooks, LttvTraceHook, k);
-        lttv_hooks_remove_data(
-            lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
-            th->h,
-            th);
+        if (th->mdata == tfs->parent.parent.tf->mdata)
+          lttv_hooks_remove_data(
+              lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
+              th->h,
+              th);
       }
       for(k = 0 ; k < after_hooks->len ; k++) {
         th = &g_array_index(after_hooks, LttvTraceHook, k);
-        lttv_hooks_remove_data(
-            lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
-            th->h,
-            th);
+        if (th->mdata == tfs->parent.parent.tf->mdata)
+          lttv_hooks_remove_data(
+              lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
+              th->h,
+              th);
         
       }
     }
This page took 0.025816 seconds and 4 git commands to generate.