X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Fcontrolflow%2Fdrawing.c;h=e0b92aa3fc526ec49bba9444916e68139249d64e;hb=f63ebe5196f36fcf40385d29cfc37288c4d70817;hp=b22931d69a8cd5e7de9fe7560d979ef965fd42b9;hpb=7b1435808100639cc2168529954d2a4c8bdc325b;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c index b22931d6..e0b92aa3 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c @@ -40,7 +40,7 @@ #define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format) //FIXME -#define TRACE_NUMBER 0 +// fixed #define TRACE_NUMBER 0 #define EXTRA_ALLOC 1024 // pixels @@ -72,7 +72,8 @@ GdkColor drawing_colors[NUM_COLORS] = { 0, 0x0000, 0xFF00, 0x0000 }, /* COL_RUN_USER_MODE : green */ { 0, 0x0100, 0x9E00, 0xFFFF }, /* COL_RUN_SYSCALL : pale blue */ { 0, 0xFF00, 0xFF00, 0x0100 }, /* COL_RUN_TRAP : yellow */ - { 0, 0xFFFF, 0x5E00, 0x0000 }, /* COL_RUN_IRQ : red */ + { 0, 0xFFFF, 0x5E00, 0x0000 }, /* COL_RUN_IRQ : orange */ + { 0, 0xFFFF, 0x9400, 0x9600 }, /* COL_RUN_SOFT_IRQ : pink */ { 0, 0x6600, 0x0000, 0x0000 }, /* COL_WAIT : dark red */ { 0, 0x7700, 0x7700, 0x0000 }, /* COL_WAIT_CPU : dark yellow */ { 0, 0x6400, 0x0000, 0x5D00 }, /* COL_ZOMBIE : dark purple */ @@ -177,12 +178,12 @@ void drawing_data_request(Drawing_t *drawing, LttvTraceHookByFacility *thf; guint ret; + gint before_hn, after_hn; nb_trace = lttv_traceset_number(traceset); - // FIXME : eventually request for more traces - // for(i = 0 ; i < nb_trace ; i++) { - for(i = 0; iparent.t, - LTT_FACILITY_ASM_I386_KERNEL, LTT_EVENT_SYSCALL_ENTRY, + LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY, LTT_FIELD_SYSCALL_ID, 0, 0, before_execmode_hook, events_request, - &g_array_index(hooks, LttvTraceHook, 0)); - g_assert(!ret); + &g_array_index(hooks, LttvTraceHook, before_hn++)); + if(ret) before_hn--; ret = lttv_trace_find_hook(ts->parent.t, - LTT_FACILITY_ASM_I386_KERNEL, LTT_EVENT_SYSCALL_EXIT, + LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_EXIT, 0, 0, 0, before_execmode_hook, events_request, - &g_array_index(hooks, LttvTraceHook, 1)); - g_assert(!ret); + &g_array_index(hooks, LttvTraceHook, before_hn++)); + if(ret) before_hn--; ret = lttv_trace_find_hook(ts->parent.t, - LTT_FACILITY_KERNEL, LTT_EVENT_TRAP_ENTRY, + LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_TRAP_ENTRY, LTT_FIELD_TRAP_ID, 0, 0, before_execmode_hook, events_request, - &g_array_index(hooks, LttvTraceHook, 2)); - g_assert(!ret); + &g_array_index(hooks, LttvTraceHook, before_hn++)); + if(ret) before_hn--; ret = lttv_trace_find_hook(ts->parent.t, - LTT_FACILITY_KERNEL, LTT_EVENT_TRAP_EXIT, + LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_TRAP_EXIT, 0, 0, 0, before_execmode_hook, events_request, - &g_array_index(hooks, LttvTraceHook, 3)); - g_assert(!ret); + &g_array_index(hooks, LttvTraceHook, before_hn++)); + if(ret) before_hn--; ret = lttv_trace_find_hook(ts->parent.t, LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_ENTRY, LTT_FIELD_IRQ_ID, 0, 0, before_execmode_hook, events_request, - &g_array_index(hooks, LttvTraceHook, 4)); - g_assert(!ret); + &g_array_index(hooks, LttvTraceHook, before_hn++)); + if(ret) before_hn--; ret = lttv_trace_find_hook(ts->parent.t, LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_EXIT, 0, 0, 0, before_execmode_hook, events_request, - &g_array_index(hooks, LttvTraceHook, 5)); - g_assert(!ret); + &g_array_index(hooks, LttvTraceHook, before_hn++)); + if(ret) before_hn--; + + ret = lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_ENTRY, + LTT_FIELD_SOFT_IRQ_ID, 0, 0, + before_execmode_hook, + events_request, + &g_array_index(hooks, LttvTraceHook, before_hn++)); + if(ret) before_hn--; + + ret = lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_EXIT, + 0, 0, 0, + before_execmode_hook, + events_request, + &g_array_index(hooks, LttvTraceHook, before_hn++)); + if(ret) before_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, + LTT_FACILITY_KERNEL, LTT_EVENT_SCHED_SCHEDULE, + LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE, before_schedchange_hook, events_request, - &g_array_index(hooks, LttvTraceHook, 6)); - g_assert(!ret); + &g_array_index(hooks, LttvTraceHook, before_hn++)); + if(ret) before_hn--; ret = lttv_trace_find_hook(ts->parent.t, - LTT_FACILITY_PROCESS, LTT_EVENT_EXIT, + LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_EXIT, LTT_FIELD_PID, 0, 0, before_process_exit_hook, events_request, - &g_array_index(hooks, LttvTraceHook, 7)); - g_assert(!ret); + &g_array_index(hooks, LttvTraceHook, before_hn++)); + if(ret) before_hn--; ret = lttv_trace_find_hook(ts->parent.t, - LTT_FACILITY_PROCESS, LTT_EVENT_FREE, + LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_FREE, LTT_FIELD_PID, 0, 0, before_process_release_hook, events_request, - &g_array_index(hooks, LttvTraceHook, 8)); - g_assert(!ret); + &g_array_index(hooks, LttvTraceHook, before_hn++)); + if(ret) before_hn--; + ret = lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_LIST, LTT_EVENT_STATEDUMP_END, + 0, 0, 0, + before_statedump_end, + 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, 7)); + &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, 7)); + 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, 8)); + NULL, process_exit, &g_array_index(hooks, LttvTraceHook, hn++)); #endif //0 /* after hooks */ @@ -315,83 +341,101 @@ void drawing_data_request(Drawing_t *drawing, #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, 8)); + 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, 9)); + 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, 10)); + 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, 11)); + 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, 12)); + 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, 13)); + 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, 8)); + &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, 9)); + &g_array_index(hooks, LttvTraceHook, hn++)); #endif //0 + after_hn = before_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, + LTT_FACILITY_KERNEL, LTT_EVENT_SCHED_SCHEDULE, + LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE, after_schedchange_hook, events_request, - &g_array_index(hooks, LttvTraceHook, 9)); - g_assert(!ret); + &g_array_index(hooks, LttvTraceHook, after_hn++)); + if(ret) after_hn--; ret = lttv_trace_find_hook(ts->parent.t, - LTT_FACILITY_PROCESS, LTT_EVENT_FORK, + LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_FORK, LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID, 0, after_process_fork_hook, events_request, - &g_array_index(hooks, LttvTraceHook, 10)); - g_assert(!ret); + &g_array_index(hooks, LttvTraceHook, after_hn++)); + if(ret) after_hn--; ret = lttv_trace_find_hook(ts->parent.t, - LTT_FACILITY_PROCESS, LTT_EVENT_EXIT, + LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_EXIT, LTT_FIELD_PID, 0, 0, after_process_exit_hook, events_request, - &g_array_index(hooks, LttvTraceHook, 11)); - g_assert(!ret); + &g_array_index(hooks, LttvTraceHook, after_hn++)); + if(ret) after_hn--; ret = lttv_trace_find_hook(ts->parent.t, LTT_FACILITY_FS, LTT_EVENT_EXEC, 0, 0, 0, after_fs_exec_hook, events_request, - &g_array_index(hooks, LttvTraceHook, 12)); - g_assert(!ret); + &g_array_index(hooks, LttvTraceHook, after_hn++)); + if(ret) after_hn--; + ret = lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_USER_GENERIC, LTT_EVENT_THREAD_BRAND, + LTT_FIELD_NAME, 0, 0, + after_user_generic_thread_brand_hook, + events_request, + &g_array_index(hooks, LttvTraceHook, after_hn++)); + if(ret) after_hn--; + ret = lttv_trace_find_hook(ts->parent.t, + LTT_FACILITY_LIST, LTT_EVENT_PROCESS_STATE, + 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, 7)); + 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, 8)); + NULL, process_exit, &g_array_index(hooks, LttvTraceHook, hn++)); #endif //0 /* Add these hooks to each event_by_id hooks list */ /* add before */ - for(k = 0 ; k < 9 ; k++) { + for(k = 0 ; k < before_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); @@ -403,7 +447,7 @@ void drawing_data_request(Drawing_t *drawing, } /* add after */ - for(k = 9 ; k < 13 ; k++) { + 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); @@ -426,7 +470,7 @@ void drawing_data_request(Drawing_t *drawing, events_request->end_time = time_end; events_request->num_events = G_MAXUINT; events_request->end_position = NULL; - events_request->trace = i; /* FIXME */ + events_request->trace = i; //fixed /* FIXME */ events_request->before_chunk_traceset = before_chunk_traceset; events_request->before_chunk_trace = NULL; events_request->before_chunk_tracefile = NULL; @@ -528,14 +572,21 @@ void drawing_chunk_begin(EventsRequest *events_request, LttvTracesetState *tss) { g_debug("Begin of chunk"); ControlFlowData *cfd = events_request->viewer_data; - LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tss); + LttvTracesetContext *tsc = &tss->parent.parent; //LttTime current_time = lttv_traceset_context_get_current_tfc(tsc)->timestamp; - guint num_cpu = - ltt_trace_get_num_cpu(tss->parent.traces[TRACE_NUMBER]->t); - - cfd->process_list->current_hash_data = g_new(HashedProcessData*,num_cpu); - memset(cfd->process_list->current_hash_data, 0, - sizeof(HashedProcessData*)*num_cpu); + guint i; + LttvTraceset *traceset = tsc->ts; + guint nb_trace = lttv_traceset_number(traceset); + + if(!cfd->process_list->current_hash_data) { + cfd->process_list->current_hash_data = g_new(HashedProcessData**,nb_trace); + for(i = 0 ; i < nb_trace ; i++) { + guint num_cpu = ltt_trace_get_num_cpu(tss->parent.traces[i]->t); + cfd->process_list->current_hash_data[i] = g_new(HashedProcessData*,num_cpu); + memset(cfd->process_list->current_hash_data[i], 0, + sizeof(HashedProcessData*)*num_cpu); + } + } //cfd->drawing->last_start = LTT_TIME_MIN(current_time, // events_request->end_time); } @@ -545,7 +596,8 @@ void drawing_request_expose(EventsRequest *events_request, LttvTracesetState *tss, LttTime end_time) { - gint x, x_end, width; + gint x, width; + guint x_end; ControlFlowData *cfd = events_request->viewer_data; LttvTracesetContext *tsc = (LttvTracesetContext*)tss; @@ -1004,6 +1056,7 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data) G_CALLBACK (button_press_event), (gpointer)drawing); + gtk_widget_show(drawing->ruler); gtk_widget_show(drawing->padding); gtk_widget_show(drawing->ruler_hbox); @@ -1083,7 +1136,7 @@ void drawing_destroy(Drawing_t *drawing) if(drawing->gc != NULL) gdk_gc_unref(drawing->gc); - g_free(drawing->pango_layout); + g_object_unref(drawing->pango_layout); if(drawing->dotted_gc != NULL) gdk_gc_unref(drawing->dotted_gc); if(drawing->ruler_gc_butt != NULL) gdk_gc_unref(drawing->ruler_gc_butt); if(drawing->ruler_gc_round != NULL) gdk_gc_unref(drawing->ruler_gc_round); @@ -1423,4 +1476,5 @@ motion_notify_ruler(GtkWidget *widget, GdkEventMotion *event, gpointer user_data { //g_debug("motion"); //eventually follow mouse and show time here + return 0; }