- hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 20);
- //hooks = g_array_set_size(hooks, 19); // Max possible number of hooks.
- //hn = 0;
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KERNEL,
- LTT_EVENT_SYSCALL_ENTRY,
- FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
- syscall_entry, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KERNEL,
- LTT_EVENT_SYSCALL_EXIT,
- NULL,
- syscall_exit, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KERNEL,
- LTT_EVENT_TRAP_ENTRY,
- FIELD_ARRAY(LTT_FIELD_TRAP_ID),
- trap_entry, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KERNEL,
- LTT_EVENT_TRAP_EXIT,
- NULL,
- trap_exit, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KERNEL,
- LTT_EVENT_PAGE_FAULT_ENTRY,
- FIELD_ARRAY(LTT_FIELD_TRAP_ID),
- trap_entry, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KERNEL,
- LTT_EVENT_PAGE_FAULT_EXIT,
- NULL,
- trap_exit, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KERNEL,
- LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY,
- FIELD_ARRAY(LTT_FIELD_TRAP_ID),
- trap_entry, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KERNEL,
- LTT_EVENT_PAGE_FAULT_NOSEM_EXIT,
- NULL,
- trap_exit, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KERNEL,
- LTT_EVENT_IRQ_ENTRY,
- FIELD_ARRAY(LTT_FIELD_IRQ_ID),
- irq_entry, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KERNEL,
- LTT_EVENT_IRQ_EXIT,
- NULL,
- irq_exit, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KERNEL,
- LTT_EVENT_SOFT_IRQ_RAISE,
- FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
- soft_irq_raise, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_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_CHANNEL_KERNEL,
- LTT_EVENT_SOFT_IRQ_EXIT,
- NULL,
- soft_irq_exit, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_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_CHANNEL_KERNEL,
- LTT_EVENT_SCHED_TRY_WAKEUP,
- FIELD_ARRAY(LTT_FIELD_PID, LTT_FIELD_CPU_ID, LTT_FIELD_STATE),
- sched_try_wakeup, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_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_CHANNEL_KERNEL,
- LTT_EVENT_KTHREAD_CREATE,
- FIELD_ARRAY(LTT_FIELD_PID),
- process_kernel_thread, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KERNEL,
- LTT_EVENT_PROCESS_EXIT,
- FIELD_ARRAY(LTT_FIELD_PID),
- process_exit, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KERNEL,
- LTT_EVENT_PROCESS_FREE,
- FIELD_ARRAY(LTT_FIELD_PID),
- process_free, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_FS,
- LTT_EVENT_EXEC,
- FIELD_ARRAY(LTT_FIELD_FILENAME),
- process_exec, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_USERSPACE,
- LTT_EVENT_THREAD_BRAND,
- FIELD_ARRAY(LTT_FIELD_NAME),
- thread_brand, NULL, &hooks);
-
- /* statedump-related hooks */
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_TASK_STATE,
- 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,
- LTT_FIELD_STATUS, LTT_FIELD_TGID),
- enum_process_state, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_GLOBAL_STATE,
- LTT_EVENT_STATEDUMP_END,
- NULL,
- statedump_end, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_IRQ_STATE,
- LTT_EVENT_LIST_INTERRUPT,
- FIELD_ARRAY(LTT_FIELD_ACTION, LTT_FIELD_IRQ_ID),
- enum_interrupt, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_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_CHANNEL_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_CHANNEL_USERSPACE,
- 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_CHANNEL_USERSPACE,
- LTT_EVENT_FUNCTION_EXIT,
- FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
- function_exit, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_SYSCALL_STATE,
- LTT_EVENT_SYS_CALL_TABLE,
- FIELD_ARRAY(LTT_FIELD_ID, LTT_FIELD_ADDRESS, LTT_FIELD_SYMBOL),
- dump_syscall, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_KPROBE_STATE,
- LTT_EVENT_KPROBE_TABLE,
- FIELD_ARRAY(LTT_FIELD_IP, LTT_FIELD_SYMBOL),
- dump_kprobe, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_SOFTIRQ_STATE,
- LTT_EVENT_SOFTIRQ_VEC,
- FIELD_ARRAY(LTT_FIELD_ID, LTT_FIELD_ADDRESS, LTT_FIELD_SYMBOL),
- dump_softirq, NULL, &hooks);
-
- lttv_trace_find_hook(ts->parent.t,
- LTT_CHANNEL_FS,
- LTT_EVENT_OPEN,
- FIELD_ARRAY(LTT_FIELD_FD, LTT_FIELD_FILENAME),
- fs_open, NULL, &hooks);
-
- /* Add these hooks to each event_by_id hooks list */
-
- nb_tracefile = ts->parent.tracefiles->len;
-
- for(j = 0 ; j < nb_tracefile ; j++) {
- tfs =
- LTTV_TRACEFILE_STATE(g_array_index(ts->parent.tracefiles,
- LttvTracefileContext*, j));
-
- for(k = 0 ; k < hooks->len ; k++) {
- th = &g_array_index(hooks, LttvTraceHook, k);
- if (th->mdata == tfs->parent.tf->mdata)
- lttv_hooks_add(
- lttv_hooks_by_id_find(tfs->parent.event_by_id, th->id),
- th->h,
- th,
- LTTV_PRIO_STATE);
- }
- }
- lttv_attribute_find(ts->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val);
- *(val.v_pointer) = hooks;
- }