From 043489505bef374a8f28cbdac81ea7dc2d2d4aac Mon Sep 17 00:00:00 2001 From: pmf Date: Fri, 12 Oct 2007 23:12:19 +0000 Subject: [PATCH] controlflow: make it work again git-svn-id: http://ltt.polymtl.ca/svn@2673 04897980-b3bd-0310-b5e0-8ef037075253 --- .../lttv/modules/gui/controlflow/drawing.c | 267 ++++++------------ .../lttv/modules/gui/controlflow/eventhooks.c | 14 +- .../modules/gui/controlflow/processlist.c | 1 - .../gui/lttvwindow/lttvwindow/lttvwindow.c | 2 +- 4 files changed, 96 insertions(+), 188 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c index 83406014..24f24bd5 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/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 @@ -178,12 +177,11 @@ void drawing_data_request(Drawing_t *drawing, LttvTraceHook *th; guint ret; - gint before_hn, after_hn; + gint 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); -#if 0 + /* After hooks */ + first_after = hooks->len; + 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++)); - - 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; - - ret = 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++) { - lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id), - th->h, - th, - 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++) { - lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id), - th->h, - th, - 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; @@ -481,38 +420,8 @@ void drawing_data_request(Drawing_t *drawing, time_end.tv_nsec); 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/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index 53d3a883..dc6c1617 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -362,8 +362,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)); } tfc->target_pid = pid_out; @@ -769,8 +769,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)); } @@ -1299,7 +1299,7 @@ int before_process_release_hook(void *hook_data, void *call_data) guint pid; { - pid = ltt_event_get_long_unsigned(e, th->f1); + pid = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); } /* Add process to process list (if not present) */ @@ -1499,7 +1499,7 @@ int after_process_fork_hook(void *hook_data, void *call_data) guint child_pid; { - child_pid = ltt_event_get_long_unsigned(e, th->f2); + child_pid = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1)); } /* Add process to process list (if not present) */ @@ -1927,7 +1927,7 @@ int after_event_enum_process_hook(void *hook_data, void *call_data) guint pid_in; { - pid_in = ltt_event_get_long_unsigned(e, th->f1); + pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); } if(pid_in == 0) { diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c index 04be3d21..8d941332 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c @@ -32,7 +32,6 @@ #include "drawitem.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) /* Preallocated Size of the index_to_pixmap array */ #define ALLOCATE_PROCESSES 1000 diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c index 4f77d883..5ff1c55c 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -1110,7 +1110,7 @@ void events_request_free(EventsRequest *events_request) if(events_request->hooks != NULL) { guint i; GArray *hooks = events_request->hooks; - lttv_trace_hook_remove_all(hooks); + lttv_trace_hook_remove_all(&hooks); g_array_free(events_request->hooks, TRUE); } if(events_request->before_chunk_traceset != NULL) -- 2.34.1