add state function stack support
[lttv.git] / ltt / branches / poly / lttv / lttv / stats.c
index 23a9cca8481b0848f17bc0855fdc068d4be3aa73..22600255efde4a29dcc9eb5bde8c88311dce8a53 100644 (file)
@@ -39,6 +39,7 @@ GQuark
   LTTV_STATS_MODE_TYPES,
   LTTV_STATS_MODES,
   LTTV_STATS_SUBMODES,
+       LTTV_STATS_FUNCTIONS,
   LTTV_STATS_EVENT_TYPES,
   LTTV_STATS_CPU_TIME,
   LTTV_STATS_ELAPSED_TIME,
@@ -417,7 +418,7 @@ find_event_tree(LttvTracefileStats *tfcs,
 static void update_event_tree(LttvTracefileStats *tfcs) 
 {
   LttvTraceState *ts = (LttvTraceState *)tfcs->parent.parent.t_context;
-  guint cpu = ltt_tracefile_num(tfcs->parent.parent.tf);
+  guint cpu = tfcs->parent.cpu;
   LttvProcessState *process = ts->running_process[cpu];
   LttvExecutionState *es = process->state;
 
@@ -431,7 +432,7 @@ static void update_event_tree(LttvTracefileStats *tfcs)
 static void mode_change(LttvTracefileStats *tfcs)
 {
   LttvTraceState *ts = (LttvTraceState *)tfcs->parent.parent.t_context;
-  guint cpu = ltt_tracefile_num(tfcs->parent.parent.tf);
+  guint cpu = tfcs->parent.cpu;
   LttvProcessState *process = ts->running_process[cpu];
   LttvAttributeValue cpu_time; 
 
@@ -448,7 +449,7 @@ static void mode_change(LttvTracefileStats *tfcs)
 static void mode_end(LttvTracefileStats *tfcs)
 {
   LttvTraceState *ts = (LttvTraceState *)tfcs->parent.parent.t_context;
-  guint cpu = ltt_tracefile_num(tfcs->parent.parent.tf);
+  guint cpu = tfcs->parent.cpu;
   LttvProcessState *process = ts->running_process[cpu];
   LttvAttributeValue elapsed_time, cpu_time; 
 
@@ -530,7 +531,6 @@ gboolean before_irq_entry(void *hook_data, void *call_data)
   return FALSE;
 }
 
-
 gboolean after_irq_entry(void *hook_data, void *call_data)
 {
   update_event_tree((LttvTracefileStats *)call_data);
@@ -552,6 +552,33 @@ gboolean after_irq_exit(void *hook_data, void *call_data)
 }
 
 
+gboolean before_soft_irq_entry(void *hook_data, void *call_data)
+{
+  mode_change((LttvTracefileStats *)call_data);
+  return FALSE;
+}
+
+gboolean after_soft_irq_entry(void *hook_data, void *call_data)
+{
+  update_event_tree((LttvTracefileStats *)call_data);
+  return FALSE;
+}
+
+
+gboolean before_soft_irq_exit(void *hook_data, void *call_data)
+{
+  mode_end((LttvTracefileStats *)call_data);
+  return FALSE;
+}
+
+
+gboolean after_soft_irq_exit(void *hook_data, void *call_data)
+{
+  update_event_tree((LttvTracefileStats *)call_data);
+  return FALSE;
+}
+
+
 gboolean before_schedchange(void *hook_data, void *call_data)
 {
   LttvTracefileStats *tfcs = (LttvTracefileStats *)call_data;
@@ -804,8 +831,8 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
     /* Find the eventtype id for the following events and register the
        associated by id hooks. */
 
-    hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 7);
-    g_array_set_size(hooks, 7);
+    hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 9);
+    g_array_set_size(hooks, 9);
 
     ret = lttv_trace_find_hook(ts->parent.parent.t,
         LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY,
@@ -849,17 +876,31 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
         &g_array_index(hooks, LttvTraceHook, 5));
     g_assert(!ret);
 
+    ret = lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_ENTRY,
+        LTT_FIELD_SOFT_IRQ_ID, 0, 0,
+        before_soft_irq_entry, NULL,
+        &g_array_index(hooks, LttvTraceHook, 6));
+    g_assert(!ret);
+
+    ret = lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_EXIT,
+        0, 0, 0,
+        before_soft_irq_exit, NULL,
+        &g_array_index(hooks, LttvTraceHook, 7));
+    g_assert(!ret);
+
     ret = lttv_trace_find_hook(ts->parent.parent.t,
         LTT_FACILITY_PROCESS, LTT_EVENT_SCHEDCHANGE,
         LTT_FIELD_OUT, LTT_FIELD_IN, LTT_FIELD_OUT_STATE,
         before_schedchange, NULL, 
-        &g_array_index(hooks, LttvTraceHook, 6));
+        &g_array_index(hooks, LttvTraceHook, 8));
     g_assert(!ret);
 
     before_hooks = hooks;
 
-    hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 9);
-    g_array_set_size(hooks, 9);
+    hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 11);
+    g_array_set_size(hooks, 11);
 
     ret = lttv_trace_find_hook(ts->parent.parent.t,
         LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY,
@@ -903,26 +944,39 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
         &g_array_index(hooks, LttvTraceHook, 5));
     g_assert(!ret);
 
+    ret = lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_ENTRY, 
+        LTT_FIELD_SOFT_IRQ_ID, 0, 0,
+        after_irq_entry, NULL,
+        &g_array_index(hooks, LttvTraceHook, 6));
+    g_assert(!ret);
+
+    ret = lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_EXIT,
+        0, 0, 0,
+        after_soft_irq_exit, NULL,
+        &g_array_index(hooks, LttvTraceHook, 7));
+    g_assert(!ret);
 
     ret = lttv_trace_find_hook(ts->parent.parent.t,
         LTT_FACILITY_PROCESS, LTT_EVENT_FORK, 
         LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID, 0,
         process_fork, NULL, 
-        &g_array_index(hooks, LttvTraceHook, 6));
+        &g_array_index(hooks, LttvTraceHook, 8));
     g_assert(!ret);
 
     ret = lttv_trace_find_hook(ts->parent.parent.t,
         LTT_FACILITY_PROCESS, LTT_EVENT_EXIT,
         LTT_FIELD_PID, 0, 0,
         process_exit, NULL,
-        &g_array_index(hooks, LttvTraceHook, 7));
+        &g_array_index(hooks, LttvTraceHook, 9));
     g_assert(!ret);
     
     ret = lttv_trace_find_hook(ts->parent.parent.t,
         LTT_FACILITY_PROCESS, LTT_EVENT_FREE,
         LTT_FIELD_PID, 0, 0,
         process_free, NULL,
-        &g_array_index(hooks, LttvTraceHook, 8));
+        &g_array_index(hooks, LttvTraceHook, 10));
     g_assert(!ret);
 
 
@@ -1056,6 +1110,7 @@ static void module_init()
   LTTV_STATS_MODE_TYPES = g_quark_from_string("mode_types");
   LTTV_STATS_MODES = g_quark_from_string("modes");
   LTTV_STATS_SUBMODES = g_quark_from_string("submodes");
+  LTTV_STATS_SUBMODES = g_quark_from_string("functions");
   LTTV_STATS_EVENT_TYPES = g_quark_from_string("event_types");
   LTTV_STATS_CPU_TIME = g_quark_from_string("cpu time");
   LTTV_STATS_ELAPSED_TIME = g_quark_from_string("elapsed time");
This page took 0.027398 seconds and 4 git commands to generate.