- hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 18);
- hooks = g_array_set_size(hooks, 18); // Max possible number of hooks.
- hn = 0;
-
- ret = lttv_trace_find_hook(ts->parent.t,
- LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY,
- LTT_FIELD_SYSCALL_ID, 0, 0,
- syscall_entry, NULL, &g_array_index(hooks, LttvTraceHook, hn++));
- if(ret) hn--;
-
- ret = lttv_trace_find_hook(ts->parent.t,
- LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_EXIT,
- 0, 0, 0,
- syscall_exit, NULL, &g_array_index(hooks, LttvTraceHook, hn++));
- if(ret) hn--;
-
- ret = lttv_trace_find_hook(ts->parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_TRAP_ENTRY,
- LTT_FIELD_TRAP_ID, 0, 0,
- trap_entry, NULL, &g_array_index(hooks, LttvTraceHook, hn++));
- if(ret) hn--;
-
- ret = lttv_trace_find_hook(ts->parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_TRAP_EXIT,
- 0, 0, 0,
- trap_exit, NULL, &g_array_index(hooks, LttvTraceHook, hn++));
- if(ret) hn--;
-
- ret = lttv_trace_find_hook(ts->parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_ENTRY,
- LTT_FIELD_IRQ_ID, 0, 0,
- irq_entry, NULL, &g_array_index(hooks, LttvTraceHook, hn++));
- if(ret) hn--;
-
- ret = lttv_trace_find_hook(ts->parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_EXIT,
- 0, 0, 0,
- irq_exit, NULL, &g_array_index(hooks, LttvTraceHook, hn++));
- if(ret) hn--;
-
- ret = lttv_trace_find_hook(ts->parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_ENTRY,
- LTT_FIELD_SOFT_IRQ_ID, 0, 0,
- soft_irq_entry, NULL, &g_array_index(hooks, LttvTraceHook, hn++));
- if(ret) hn--;
-
- ret = lttv_trace_find_hook(ts->parent.t,
- LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_EXIT,
- 0, 0, 0,
- soft_irq_exit, NULL, &g_array_index(hooks, LttvTraceHook, hn++));
- if(ret) hn--;
-
- ret = lttv_trace_find_hook(ts->parent.t,
- LTT_FACILITY_PROCESS, LTT_EVENT_SCHEDCHANGE,
- LTT_FIELD_OUT, LTT_FIELD_IN, LTT_FIELD_OUT_STATE,
- schedchange, NULL, &g_array_index(hooks, LttvTraceHook, hn++));
- if(ret) hn--;
-
- ret = lttv_trace_find_hook(ts->parent.t,
- LTT_FACILITY_PROCESS, LTT_EVENT_FORK,
- LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID, LTT_FIELD_TGID,
- process_fork, NULL, &g_array_index(hooks, LttvTraceHook, hn++));
- if(ret) hn--;
-
- ret = lttv_trace_find_hook(ts->parent.t,
- LTT_FACILITY_PROCESS, LTT_EVENT_KERNEL_THREAD,
- LTT_FIELD_PID, 0, 0,
- process_kernel_thread, NULL, &g_array_index(hooks, LttvTraceHook,
- hn++));
- if(ret) hn--;
-
- ret = lttv_trace_find_hook(ts->parent.t,
- LTT_FACILITY_PROCESS, LTT_EVENT_EXIT,
- LTT_FIELD_PID, 0, 0,
- process_exit, NULL, &g_array_index(hooks, LttvTraceHook, hn++));
- if(ret) hn--;
+ hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 19);
+ //hooks = g_array_set_size(hooks, 19); // Max possible number of hooks.
+ //hn = 0;
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_EVENT_SYSCALL_ENTRY,
+ FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
+ syscall_entry, NULL, &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_EVENT_SYSCALL_EXIT,
+ NULL,
+ syscall_exit, NULL, &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_EVENT_TRAP_ENTRY,
+ FIELD_ARRAY(LTT_FIELD_TRAP_ID),
+ trap_entry, NULL, &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_EVENT_TRAP_EXIT,
+ NULL,
+ trap_exit, NULL, &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_EVENT_IRQ_ENTRY,
+ FIELD_ARRAY(LTT_FIELD_IRQ_ID),
+ irq_entry, NULL, &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_EVENT_IRQ_EXIT,
+ NULL,
+ irq_exit, NULL, &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ 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_EVENT_SOFT_IRQ_EXIT,
+ NULL,
+ soft_irq_exit, NULL, &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ 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_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_EVENT_KTHREAD_CREATE,
+ FIELD_ARRAY(LTT_FIELD_PID)
+ process_kernel_thread, NULL, &hooks);
+
+ lttv_trace_find_hook(ts->parent.t,
+ LTT_EVENT_PROCESS_EXIT,
+ FIELD_ARRAY(LTT_FIELD_PID),
+ process_exit, NULL, &hooks);