From ca5c76edcc349ca600edde3ecfd0f93b1505625d Mon Sep 17 00:00:00 2001 From: pmf Date: Sun, 14 Oct 2007 20:49:26 +0000 Subject: [PATCH] resourceview: make it work again git-svn-id: http://ltt.polymtl.ca/svn@2676 04897980-b3bd-0310-b5e0-8ef037075253 --- .../lttv/modules/gui/resourceview/drawing.c | 287 ++++++------------ .../modules/gui/resourceview/eventhooks.c | 31 +- 2 files changed, 110 insertions(+), 208 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/gui/resourceview/drawing.c b/ltt/branches/poly/lttv/modules/gui/resourceview/drawing.c index a03809c6..519e69ae 100644 --- a/ltt/branches/poly/lttv/modules/gui/resourceview/drawing.c +++ b/ltt/branches/poly/lttv/modules/gui/resourceview/drawing.c @@ -37,7 +37,6 @@ #include "cfv.h" //#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format) -//#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format) //FIXME // fixed #define TRACE_NUMBER 0 @@ -187,12 +186,11 @@ void drawing_data_request(Drawing_t *drawing, LttvTraceHook *th; guint ret; - gint before_hn, after_hn; + guint first_after; nb_trace = lttv_traceset_number(traceset); // FIXME (fixed) : eventually request for more traces for(i = 0 ; i < nb_trace ; i++) { - //for(i = 0; iparent.t, +// lttv_trace_find_hook(ts->parent.t, +// LTT_FACILITY_KERNEL_ARCH, // LTT_EVENT_SYSCALL_ENTRY, -// LTT_FIELD_SYSCALL_ID, 0, 0, +// FIELD_ARRAY(LTT_FIELD_SYSCALL_ID), // before_execmode_hook, // events_request, -// &g_array_index(hooks, LttvTraceHook, before_hn++)); -// if(ret) before_hn--; +// &hooks); // -// ret = lttv_trace_find_hook(ts->parent.t, +// lttv_trace_find_hook(ts->parent.t, +// LTT_FACILITY_KERNEL_ARCH, // LTT_EVENT_SYSCALL_EXIT, -// 0, 0, 0, +// NULL, // before_execmode_hook, // events_request, -// &g_array_index(hooks, LttvTraceHook, before_hn++)); -// if(ret) before_hn--; +// &hooks); // - ret = lttv_trace_find_hook(ts->parent.t, + lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_TRAP_ENTRY, - LTT_FIELD_TRAP_ID, 0, 0, + FIELD_ARRAY(LTT_FIELD_TRAP_ID), before_execmode_hook, events_request, - &g_array_index(hooks, LttvTraceHook, before_hn++)); - if(ret) before_hn--; + &hooks); - ret = lttv_trace_find_hook(ts->parent.t, + lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_TRAP_EXIT, - 0, 0, 0, + NULL, before_execmode_hook, events_request, - &g_array_index(hooks, LttvTraceHook, before_hn++)); - if(ret) before_hn--; + &hooks); - ret = lttv_trace_find_hook(ts->parent.t, + lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_ENTRY, - LTT_FIELD_IRQ_ID, 0, 0, + FIELD_ARRAY(LTT_FIELD_IRQ_ID), before_execmode_hook, events_request, - &g_array_index(hooks, LttvTraceHook, before_hn++)); - if(ret) before_hn--; + &hooks); - ret = lttv_trace_find_hook(ts->parent.t, + lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_EXIT, - 0, 0, 0, + NULL, before_execmode_hook, events_request, - &g_array_index(hooks, LttvTraceHook, before_hn++)); - if(ret) before_hn--; + &hooks); // -// ret = lttv_trace_find_hook(ts->parent.t, +// lttv_trace_find_hook(ts->parent.t, +// LTT_FACILITY_KERNEL, // LTT_EVENT_SOFT_IRQ_ENTRY, -// LTT_FIELD_SOFT_IRQ_ID, 0, 0, +// FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID), // before_execmode_hook, // events_request, -// &g_array_index(hooks, LttvTraceHook, before_hn++)); -// if(ret) before_hn--; +// &hooks); // -// ret = lttv_trace_find_hook(ts->parent.t, +// lttv_trace_find_hook(ts->parent.t, +// LTT_FACILITY_KERNEL, // LTT_EVENT_SOFT_IRQ_EXIT, -// 0, 0, 0, +// NULL, // before_execmode_hook, // events_request, -// &g_array_index(hooks, LttvTraceHook, before_hn++)); -// if(ret) before_hn--; +// &hooks); - ret = lttv_trace_find_hook(ts->parent.t, + lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_KERNEL, LTT_EVENT_SCHED_SCHEDULE, - LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE, + FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE), before_schedchange_hook, events_request, - &g_array_index(hooks, LttvTraceHook, before_hn++)); - if(ret) before_hn--; + &hooks); -// ret = lttv_trace_find_hook(ts->parent.t, +// lttv_trace_find_hook(ts->parent.t, +// LTT_FACILITY_KERNEL, // LTT_EVENT_PROCESS_EXIT, -// LTT_FIELD_PID, 0, 0, +// FIELD_ARRAY(LTT_FIELD_PID), // before_process_exit_hook, // events_request, -// &g_array_index(hooks, LttvTraceHook, before_hn++)); -// if(ret) before_hn--; +// &hooks); // -// ret = lttv_trace_find_hook(ts->parent.t, +// lttv_trace_find_hook(ts->parent.t, +// LTT_FACILITY_KERNEL, // LTT_EVENT_PROCESS_FREE, -// LTT_FIELD_PID, 0, 0, +// FIELD_ARRAY(LTT_FIELD_PID), // before_process_release_hook, // events_request, -// &g_array_index(hooks, LttvTraceHook, before_hn++)); -// if(ret) before_hn--; +// &hooks); // -// ret = lttv_trace_find_hook(ts->parent.t, +// lttv_trace_find_hook(ts->parent.t, +// LTT_FACILITY_LIST, // LTT_EVENT_STATEDUMP_END, -// 0, 0, 0, +// NULL, // before_statedump_end, // events_request, -// &g_array_index(hooks, LttvTraceHook, before_hn++)); -// if(ret) before_hn--; +// &hooks); - ret = lttv_trace_find_hook(ts->parent.t, + lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_KERNEL, LTT_EVENT_REQUEST_ISSUE, - LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION, + FIELD_ARRAY(LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION), before_bdev_event_hook, events_request, - &g_array_index(hooks, LttvTraceHook, before_hn++)); - if(ret) before_hn--; + &hooks); - ret = lttv_trace_find_hook(ts->parent.t, + lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_KERNEL, LTT_EVENT_REQUEST_COMPLETE, - LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION, + FIELD_ARRAY(LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION), before_bdev_event_hook, events_request, - &g_array_index(hooks, LttvTraceHook, before_hn++)); - if(ret) before_hn--; - -#if 0 - lttv_trace_find_hook(ts->parent.t, - "core", "process", "event_sub_id", - "event_data1", "event_data2", before_process_hook, - &g_array_index(hooks, LttvTraceHook, hn++)); -#endif //0 -#if 0 - lttv_trace_find_hook(ts->parent.t, "core", "process_fork", "child_pid", - NULL, NULL, process_fork, &g_array_index(hooks, LttvTraceHook, hn++)); - - lttv_trace_find_hook(ts->parent.t, "core", "process_exit", NULL, NULL, - NULL, process_exit, &g_array_index(hooks, LttvTraceHook, hn++)); -#endif //0 - - /* after hooks */ - -#if 0 - /**** DESACTIVATED ****/ - lttv_trace_find_hook(ts->parent.t, "core","syscall_entry","syscall_id", - NULL, NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++)); - /**** DESACTIVATED ****/ - lttv_trace_find_hook(ts->parent.t, "core", "syscall_exit", NULL, NULL, - NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++)); - - /**** DESACTIVATED ****/ - lttv_trace_find_hook(ts->parent.t, "core", "trap_entry", "trap_id", - NULL, NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++)); - - /**** DESACTIVATED ****/ - lttv_trace_find_hook(ts->parent.t, "core", "trap_exit", NULL, NULL, NULL, - after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++)); - - /**** DESACTIVATED ****/ - lttv_trace_find_hook(ts->parent.t, "core", "irq_entry", "irq_id", NULL, - NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++)); - - /**** DESACTIVATED ****/ - lttv_trace_find_hook(ts->parent.t, "core", "irq_exit", NULL, NULL, NULL, - after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++)); -#endif //0 -#if 0 - lttv_trace_find_hook(ts->parent.t, "core", "schedchange", "in", "out", - "out_state", after_schedchange_hook, - &g_array_index(hooks, LttvTraceHook, hn++)); + &hooks); - lttv_trace_find_hook(ts->parent.t, "core", "process", "event_sub_id", - "event_data1", "event_data2", after_process_hook, - &g_array_index(hooks, LttvTraceHook, hn++)); -#endif //0 - after_hn = before_hn; + /* After hooks */ + first_after = hooks->len; - ret = lttv_trace_find_hook(ts->parent.t, + lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_KERNEL, LTT_EVENT_SCHED_SCHEDULE, - LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE, + FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE), after_schedchange_hook, events_request, - &g_array_index(hooks, LttvTraceHook, after_hn++)); - if(ret) after_hn--; + &hooks); -// ret = lttv_trace_find_hook(ts->parent.t, +// lttv_trace_find_hook(ts->parent.t, +// LTT_FACILITY_KERNEL, // LTT_EVENT_PROCESS_FORK, -// LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID, 0, +// FIELD_ARRAY(LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID), // after_process_fork_hook, // events_request, -// &g_array_index(hooks, LttvTraceHook, after_hn++)); -// if(ret) after_hn--; +// &hooks); // -// ret = lttv_trace_find_hook(ts->parent.t, +// lttv_trace_find_hook(ts->parent.t, +// LTT_FACILITY_KERNEL, // LTT_EVENT_PROCESS_EXIT, -// LTT_FIELD_PID, 0, 0, +// FIELD_ARRAY(LTT_FIELD_PID), // after_process_exit_hook, // events_request, -// &g_array_index(hooks, LttvTraceHook, after_hn++)); -// if(ret) after_hn--; +// &hooks); // -// ret = lttv_trace_find_hook(ts->parent.t, +// lttv_trace_find_hook(ts->parent.t, +// LTT_FACILITY_KERNEL, // LTT_EVENT_EXEC, -// 0, 0, 0, +// NULL, // after_fs_exec_hook, // events_request, -// &g_array_index(hooks, LttvTraceHook, after_hn++)); -// if(ret) after_hn--; +// &hooks); // -// ret = lttv_trace_find_hook(ts->parent.t, +// lttv_trace_find_hook(ts->parent.t, +// LTT_FACILITY_USER_GENERIC, // LTT_EVENT_THREAD_BRAND, -// LTT_FIELD_NAME, 0, 0, +// FIELD_ARRAY(LTT_FIELD_NAME), // after_user_generic_thread_brand_hook, // events_request, -// &g_array_index(hooks, LttvTraceHook, after_hn++)); -// if(ret) after_hn--; +// &hooks); // -// ret = lttv_trace_find_hook(ts->parent.t, +// lttv_trace_find_hook(ts->parent.t, +// LTT_FACILITY_LIST, // LTT_EVENT_PROCESS_STATE, -// LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME, +// FIELD_ARRAY(LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME), // after_event_enum_process_hook, // events_request, -// &g_array_index(hooks, LttvTraceHook, after_hn++)); -// if(ret) after_hn--; - - hooks = g_array_set_size(hooks, after_hn); - -#if 0 - lttv_trace_find_hook(ts->parent.t, "core", "process_fork", "child_pid", - NULL, NULL, process_fork, &g_array_index(hooks, LttvTraceHook, hn++)); - - lttv_trace_find_hook(ts->parent.t, "core", "process_exit", NULL, NULL, - NULL, process_exit, &g_array_index(hooks, LttvTraceHook, hn++)); -#endif //0 - +// &hooks); /* Add these hooks to each event_by_id hooks list */ /* add before */ - for(k = 0 ; k < before_hn ; k++) { - hook = &g_array_index(hooks, LttvTraceHook, k); - lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, thf->id), - thf->h, - thf, - LTTV_PRIO_STATE-5); + for(k = 0 ; k < first_after ; k++) { + th = &g_array_index(hooks, LttvTraceHook, k); + lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id), + th->h, + th, + LTTV_PRIO_STATE-5); } /* add after */ - for(k = before_hn ; k < after_hn ; k++) { - hook = &g_array_index(hooks, LttvTraceHook, k); - for(l=0;lfac_list->len;l++) { - thf = g_array_index(hook->fac_list, LttvTraceHookByFacility*, l); - lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, thf->id), - thf->h, - thf, - LTTV_PRIO_STATE+5); - } + for(k = first_after ; k < hooks->len ; k++) { + th = &g_array_index(hooks, LttvTraceHook, k); + lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id), + th->h, + th, + LTTV_PRIO_STATE+5); } events_request->hooks = hooks; @@ -513,36 +447,7 @@ void drawing_data_request(Drawing_t *drawing, lttvwindow_events_request(tab, events_request); } - } - -#if 0 - lttv_hooks_add(event, - before_schedchange_hook, - events_request, - LTTV_PRIO_STATE-5); - lttv_hooks_add(event, - after_schedchange_hook, - events_request, - LTTV_PRIO_STATE+5); - lttv_hooks_add(event, - before_execmode_hook, - events_request, - LTTV_PRIO_STATE-5); - lttv_hooks_add(event, - after_execmode_hook, - events_request, - LTTV_PRIO_STATE+5); - lttv_hooks_add(event, - before_process_hook, - events_request, - LTTV_PRIO_STATE-5); - lttv_hooks_add(event, - after_process_hook, - events_request, - LTTV_PRIO_STATE+5); -#endif //0 - } diff --git a/ltt/branches/poly/lttv/modules/gui/resourceview/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/resourceview/eventhooks.c index 945cc622..2c7d1e0c 100644 --- a/ltt/branches/poly/lttv/modules/gui/resourceview/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/resourceview/eventhooks.c @@ -427,8 +427,8 @@ int before_schedchange_hook(void *hook_data, void *call_data) guint pid_out; guint pid_in; - pid_out = ltt_event_get_long_unsigned(e, th->f1); - pid_in = ltt_event_get_long_unsigned(e, th->f2); + pid_out = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); + pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1)); // if(pid_in != 0 && pid_out != 0) { // /* not a transition to/from idle */ // return 0; @@ -848,8 +848,8 @@ int after_schedchange_hook(void *hook_data, void *call_data) guint pid_in; { guint pid_out; - pid_out = ltt_event_get_long_unsigned(e, th->f1); - pid_in = ltt_event_get_long_unsigned(e, th->f2); + pid_out = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); + pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1)); } @@ -1160,6 +1160,8 @@ int before_execmode_hook_irq(void *hook_data, void *call_data) LttTime evtime = ltt_event_time(e); + LttTrace *trace = tfc->t_context->t; + GQuark resourceq; /* we are in a execmode, before the state update. We must draw the @@ -1171,17 +1173,12 @@ int before_execmode_hook_irq(void *hook_data, void *call_data) guint64 irq; guint cpu = tfs->cpu; - LttFacility *ev_facility = ltt_event_facility(e); - if(ltt_facility_name(ev_facility) != LTT_FACILITY_KERNEL) - return 0; - guint8 ev_id_entry = ltt_eventtype_id(ltt_facility_eventtype_get_by_name(ev_facility, LTT_EVENT_IRQ_ENTRY)); - guint8 ev_id_exit = ltt_eventtype_id(ltt_facility_eventtype_get_by_name(ev_facility, LTT_EVENT_IRQ_EXIT)); - if(ltt_facility_name(ev_facility) == LTT_FACILITY_KERNEL && - ev_id_entry == ltt_event_eventtype_id(e)) { - irq = ltt_event_get_long_unsigned(e, th->f1); + guint16 ev_id_entry = marker_get_id_from_info(trace, marker_get_info_from_name(trace, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_ENTRY))); + guint16 ev_id_exit = marker_get_id_from_info(trace, marker_get_info_from_name(trace, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_EXIT))); + if(ev_id_entry == e->event_id) { + irq = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); } - else if(ltt_facility_name(ev_facility) == LTT_FACILITY_KERNEL && - ev_id_exit == ltt_event_eventtype_id(e)) { + else if(ev_id_exit == e->event_id) { irq = ts->cpu_states[cpu].last_irq; } else { @@ -1380,9 +1377,9 @@ int before_bdev_event_hook(void *hook_data, void *call_data) /* For the pid */ guint cpu = tfs->cpu; - guint8 major = ltt_event_get_long_unsigned(e, th->f1); - guint8 minor = ltt_event_get_long_unsigned(e, th->f2); - guint oper = ltt_event_get_long_unsigned(e, th->f3); + guint8 major = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); + guint8 minor = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1)); + guint oper = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 2)); gint devcode_gint = MKDEV(major,minor); { -- 2.34.1