add facility arg to find hooks
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 11 Oct 2007 03:44:21 +0000 (03:44 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 11 Oct 2007 03:44:21 +0000 (03:44 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2649 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/state.c
ltt/branches/poly/lttv/lttv/stats.c
ltt/branches/poly/lttv/lttv/tracecontext.c
ltt/branches/poly/lttv/lttv/tracecontext.h

index 92c2aec5006797a6c2713515560fc62a887496c3..d1120c7097c49b1ddcbf8761c113978b96f62713 100644 (file)
@@ -1633,6 +1633,7 @@ create_name_tables(LttvTraceState *tcs)
   hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 1);
 
   if(!lttv_trace_find_hook(tcs->parent.t,
+      LTT_FACILITY_KERNEL_ARCH,
       LTT_EVENT_SYSCALL_ENTRY,
       FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
       NULL, NULL, &hooks)) {
@@ -1667,6 +1668,7 @@ create_name_tables(LttvTraceState *tcs)
   lttv_trace_hook_remove_all(&hooks);
 
   if(!lttv_trace_find_hook(tcs->parent.t,
+        LTT_FACILITY_KERNEL_ARCH,
         LTT_EVENT_TRAP_ENTRY,
         FIELD_ARRAY(LTT_FIELD_TRAP_ID),
         NULL, NULL, &hooks)) {
@@ -1695,6 +1697,7 @@ create_name_tables(LttvTraceState *tcs)
   lttv_trace_hook_remove_all(&hooks);
 
   if(!lttv_trace_find_hook(tcs->parent.t,
+        LTT_FACILITY_KERNEL,
         LTT_EVENT_IRQ_ENTRY,
         FIELD_ARRAY(LTT_FIELD_IRQ_ID),
         NULL, NULL, &hooks)) {
@@ -3034,84 +3037,100 @@ void lttv_state_add_event_hooks(LttvTracesetState *self)
     //hn = 0;
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL_ARCH,
         LTT_EVENT_SYSCALL_ENTRY,
         FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
        syscall_entry, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL_ARCH,
         LTT_EVENT_SYSCALL_EXIT,
         NULL,
         syscall_exit, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL_ARCH,
         LTT_EVENT_TRAP_ENTRY,
         FIELD_ARRAY(LTT_FIELD_TRAP_ID),
         trap_entry, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL_ARCH,
         LTT_EVENT_TRAP_EXIT,
         NULL,
         trap_exit, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL,
         LTT_EVENT_IRQ_ENTRY,
         FIELD_ARRAY(LTT_FIELD_IRQ_ID),
         irq_entry, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL,
         LTT_EVENT_IRQ_EXIT,
         NULL,
         irq_exit, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL,
         LTT_EVENT_SOFT_IRQ_ENTRY,
         FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
         soft_irq_entry, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL,
         LTT_EVENT_SOFT_IRQ_EXIT,
         NULL,
         soft_irq_exit, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL,
         LTT_EVENT_SCHED_SCHEDULE,
         FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID,
          LTT_FIELD_PREV_STATE),
         schedchange, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL,
         LTT_EVENT_PROCESS_FORK,
         FIELD_ARRAY(LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID,
          LTT_FIELD_CHILD_TGID),
         process_fork, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL_ARCH,
         LTT_EVENT_KTHREAD_CREATE,
         FIELD_ARRAY(LTT_FIELD_PID),
         process_kernel_thread, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL,
         LTT_EVENT_PROCESS_EXIT,
         FIELD_ARRAY(LTT_FIELD_PID),
         process_exit, NULL, &hooks);
     
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL,
         LTT_EVENT_PROCESS_FREE,
         FIELD_ARRAY(LTT_FIELD_PID),
         process_free, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_KERNEL,
         LTT_EVENT_EXEC,
         FIELD_ARRAY(LTT_FIELD_FILENAME),
         process_exec, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_USER_GENERIC,
         LTT_EVENT_THREAD_BRAND,
         FIELD_ARRAY(LTT_FIELD_NAME),
         thread_brand, NULL, &hooks);
 
      /* statedump-related hooks */
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_LIST,
         LTT_EVENT_PROCESS_STATE,
         FIELD_ARRAY(LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME,
          LTT_FIELD_TYPE, LTT_FIELD_MODE, LTT_FIELD_SUBMODE,
@@ -3119,31 +3138,37 @@ void lttv_state_add_event_hooks(LttvTracesetState *self)
         enum_process_state, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_LIST,
         LTT_EVENT_STATEDUMP_END,
         NULL,
         statedump_end, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_LIST,
         LTT_EVENT_LIST_INTERRUPT,
         FIELD_ARRAY(LTT_FIELD_ACTION, LTT_FIELD_NUM),
         enum_interrupt, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_BLOCK,
         LTT_EVENT_REQUEST_ISSUE,
         FIELD_ARRAY(LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION),
         bdev_request_issue, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_BLOCK,
         LTT_EVENT_REQUEST_COMPLETE,
         FIELD_ARRAY(LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION),
         bdev_request_complete, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_USER_GENERIC,
         LTT_EVENT_FUNCTION_ENTRY,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         function_entry, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
+        LTT_FACILITY_USER_GENERIC,
         LTT_EVENT_FUNCTION_EXIT,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         function_exit, NULL, &hooks);
index 3663cbcef94ca33d32b76576b49037008cbd1ff1..0bfb45462d9d6eee7fa5207b795afb36a3f2acb5 100644 (file)
@@ -1068,66 +1068,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_ARCH,
         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_ARCH,
         LTT_EVENT_SYSCALL_EXIT,
         NULL,
         before_syscall_exit, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_KERNEL_ARCH,
         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_ARCH,
         LTT_EVENT_TRAP_EXIT,
         NULL,
         before_trap_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_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_EVENT_IRQ_EXIT,
         NULL,
         before_irq_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_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_EVENT_SOFT_IRQ_EXIT,
         NULL,
         before_soft_irq_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_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_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_EVENT_FUNCTION_EXIT,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         before_function_exit, NULL,
@@ -1135,6 +1146,7 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
 
     /* statedump-related hooks */
     lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_LIST,
         LTT_EVENT_PROCESS_STATE,
         FIELD_ARRAY(LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME),
         before_enum_process_state, NULL,
@@ -1145,84 +1157,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_ARCH,
         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_ARCH,
         LTT_EVENT_SYSCALL_EXIT,
         NULL,
         after_syscall_exit, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_KERNEL_ARCH,
         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_ARCH,
         LTT_EVENT_TRAP_EXIT,
         NULL,
         after_trap_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_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_EVENT_IRQ_EXIT,
         NULL,
         after_irq_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_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_EVENT_SOFT_IRQ_EXIT,
         NULL,
         after_soft_irq_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_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_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_EVENT_PROCESS_EXIT,
         FIELD_ARRAY(LTT_FIELD_PID),
         process_exit, NULL,
         &hooks);
     
     lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_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_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_EVENT_FUNCTION_EXIT,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         after_function_exit, NULL,
@@ -1230,12 +1256,14 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
 
     /* statedump-related hooks */
     lttv_trace_find_hook(ts->parent.parent.t,
+        LTT_FACILITY_LIST,
         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_EVENT_STATEDUMP_END,
         NULL,
         after_statedump_end, NULL,
index 3a72ef8ca6e6413272e4f008a67c1185dcbe769a..71c9598730053c7aed0337d714cb806c000cddd2 100644 (file)
@@ -968,13 +968,32 @@ struct marker_info *lttv_trace_hook_get_marker(LttTrace *t, LttvTraceHook *th)
   return marker_get_info_from_id(t, th->id);
 }
 
+static inline GQuark lttv_merge_facility_event_name(GQuark fac, GQuark ev)
+{
+  char *tmp;
+  const char *sfac, *sev;
+  GQuark ret;
+
+  sfac = g_quark_to_string(fac);
+  sev = g_quark_to_string(ev);
+  tmp = g_new(char, strlen(sfac) + strlen(sev) + 3); /* 3: _ \0 \0 */
+  strcpy(tmp, sfac);
+  strcat(tmp, "_");
+  strcat(tmp, sev);
+  ret = g_quark_from_string(tmp);
+  g_free(tmp);
+  return ret;
+}
 
-int lttv_trace_find_hook(LttTrace *t, GQuark marker_name,
+int lttv_trace_find_hook(LttTrace *t, GQuark facility_name, GQuark event_name,
     GQuark fields[], LttvHook h, gpointer hook_data, GArray **trace_hooks)
 {
   struct marker_info *info;
   guint16 marker_id;
   int init_array_size;
+  GQuark marker_name;
+
+  marker_name = lttv_merge_facility_event_name(facility_name, event_name);
 
   info = marker_get_info_from_name(t, marker_name);
   if(unlikely(info == NULL)) {
index 2ec68be057264c2a12997982af21c228790026ba..ed1d28d6d35840cde0f85df1bbe165bce2198b9b 100644 (file)
@@ -298,7 +298,7 @@ void lttv_trace_hook_remove_all(GArray **th);
    Adds the hooks to the trace_hooks array.
  */
 
-int lttv_trace_find_hook(LttTrace *t, GQuark marker_name,
+int lttv_trace_find_hook(LttTrace *t, GQuark facility_name, GQuark event_name,
     GQuark fields[], LttvHook h, gpointer hook_data, GArray **trace_hooks);
 
 static inline struct marker_field *
This page took 0.032437 seconds and 4 git commands to generate.