From: Yannick Brosseau Date: Fri, 10 May 2013 00:45:55 +0000 (-0400) Subject: Reenable resource view X-Git-Tag: v1.5-beta1~14 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=dd47d0d8af96afdc24f6a5465a42d7db3ac8c038;p=lttv.git Reenable resource view The resource display some data. We still need to validate that they are the right ones Signed-off-by: Yannick Brosseau --- diff --git a/lttv/modules/gui/Makefile.am b/lttv/modules/gui/Makefile.am index a4eeac28..93912dc6 100644 --- a/lttv/modules/gui/Makefile.am +++ b/lttv/modules/gui/Makefile.am @@ -6,7 +6,7 @@ # WARNING : subdirs order is important : mainWin depends on API -SUBDIRS = lttvwindow detailedevents histogram controlflow +SUBDIRS = lttvwindow detailedevents histogram controlflow resourceview # statistics filter tracecontrol interrupts resourceview # TODO: PORT for 0.10 #diskperformance tutorial diff --git a/lttv/modules/gui/controlflow/drawing.c b/lttv/modules/gui/controlflow/drawing.c index 53048b5b..9fac5cd3 100644 --- a/lttv/modules/gui/controlflow/drawing.c +++ b/lttv/modules/gui/controlflow/drawing.c @@ -27,9 +27,6 @@ #include #include -#ifdef BABEL_CLEANUP -#include -#endif //babel_cleanup #include #include #include diff --git a/lttv/modules/gui/controlflow/drawitem.c b/lttv/modules/gui/controlflow/drawitem.c index d4e2c90a..06cbde8e 100644 --- a/lttv/modules/gui/controlflow/drawitem.c +++ b/lttv/modules/gui/controlflow/drawitem.c @@ -105,9 +105,7 @@ #include #include #include -#ifdef BABEL_CLEANUP -#include -#endif //babel_cleanup + #include #include diff --git a/lttv/modules/gui/controlflow/eventhooks.c b/lttv/modules/gui/controlflow/eventhooks.c index ef5cbc62..e311da65 100644 --- a/lttv/modules/gui/controlflow/eventhooks.c +++ b/lttv/modules/gui/controlflow/eventhooks.c @@ -130,8 +130,7 @@ static void request_background_data(ControlFlowData *control_flow_data) for(i=0;istate; - + if(lttvwindowtraces_get_ready(g_quark_from_string("state"),trace)==FALSE && !ts->has_precomputed_states) { diff --git a/lttv/modules/gui/resourceview/cfv.c b/lttv/modules/gui/resourceview/cfv.c index d9243313..fda59bd0 100644 --- a/lttv/modules/gui/resourceview/cfv.c +++ b/lttv/modules/gui/resourceview/cfv.c @@ -266,8 +266,9 @@ guicontrolflow_destructor(gpointer data) g_info("%p, %p, %p", update_time_window_hook, plugin_cfv, tab); if(GTK_IS_WIDGET(guicontrolflow_get_widget(plugin_cfv->cfd))) g_info("widget still exists"); - +#ifdef BABEL_CLEANUP lttv_filter_destroy(plugin_cfv->cfd->filter); +#endif //babel_cleanup /* Process List is removed with it's widget */ //ProcessList_destroy(control_flow_data->process_list); if(tab != NULL) diff --git a/lttv/modules/gui/resourceview/drawing.c b/lttv/modules/gui/resourceview/drawing.c index 69007e1f..d8f70d5d 100644 --- a/lttv/modules/gui/resourceview/drawing.c +++ b/lttv/modules/gui/resourceview/drawing.c @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -151,6 +150,7 @@ void drawing_data_request(Drawing_t *drawing, Tab *tab = drawing->control_flow_data->tab; TimeWindow time_window = lttvwindow_get_time_window(tab); + LttvTraceset *traceset = lttvwindow_get_traceset(tab); ControlFlowData *control_flow_data = drawing->control_flow_data; // (ControlFlowData*)g_object_get_data( @@ -184,12 +184,16 @@ void drawing_data_request(Drawing_t *drawing, control_flow_data); { + LttvHooks *event_hook = lttv_hooks_new(); + + lttv_hooks_add(event_hook,before_schedchange_hook , control_flow_data, LTTV_PRIO_STATE-5); + lttv_hooks_add(event_hook,before_execmode_hook , control_flow_data, LTTV_PRIO_STATE-5); + lttv_hooks_add(event_hook, after_schedchange_hook, control_flow_data, LTTV_PRIO_STATE+5); + /* find the tracehooks */ - LttvTracesetContext *tsc = lttvwindow_get_traceset_context(tab); - LttvTraceset *traceset = tsc->ts; + LttvTraceState *ts; GArray *hooks; - LttvTraceHook *th; guint i, k; guint first_after; @@ -200,8 +204,7 @@ void drawing_data_request(Drawing_t *drawing, EventsRequest *events_request = g_new(EventsRequest, 1); // Create the hooks //LttvHooks *event = lttv_hooks_new(); - LttvHooksByIdChannelArray *event_by_id_channel = - lttv_hooks_by_id_channel_new(); + LttvHooks *before_chunk_traceset = lttv_hooks_new(); LttvHooks *after_chunk_traceset = lttv_hooks_new(); LttvHooks *before_request_hook = lttv_hooks_new(); @@ -227,7 +230,7 @@ void drawing_data_request(Drawing_t *drawing, events_request, LTTV_PRIO_DEFAULT); - +#ifdef BABEL_CLEANUP ts = (LttvTraceState *)tsc->traces[i]; /* Find the eventtype id for the following events and register the @@ -464,7 +467,7 @@ void drawing_data_request(Drawing_t *drawing, } events_request->hooks = hooks; - +#endif // Fill the events request events_request->owner = control_flow_data; events_request->viewer_data = control_flow_data; @@ -479,8 +482,7 @@ void drawing_data_request(Drawing_t *drawing, events_request->before_chunk_traceset = before_chunk_traceset; events_request->before_chunk_trace = NULL; events_request->before_chunk_tracefile = NULL; - events_request->event = NULL; - events_request->event_by_id_channel = event_by_id_channel; + events_request->event = event_hook; events_request->after_chunk_tracefile = NULL; events_request->after_chunk_trace = NULL; events_request->after_chunk_traceset = after_chunk_traceset; @@ -520,7 +522,7 @@ static void set_last_start(gpointer key, gpointer value, gpointer user_data) return; } -void drawing_data_request_begin(EventsRequest *events_request, LttvTracesetState *tss) +void drawing_data_request_begin(EventsRequest *events_request) { int i; @@ -547,19 +549,17 @@ void drawing_data_request_begin(EventsRequest *events_request, LttvTracesetState } -void drawing_chunk_begin(EventsRequest *events_request, LttvTracesetState *tss) +void drawing_chunk_begin(EventsRequest *events_request, LttvTraceset *ts) { g_debug("Begin of chunk"); ControlFlowData *cfd = events_request->viewer_data; - LttvTracesetContext *tsc = &tss->parent; guint i; - LttvTraceset *traceset = tsc->ts; - guint nb_trace = lttv_traceset_number(traceset); + guint nb_trace = lttv_traceset_number(ts); if(!cfd->process_list->current_hash_data) { cfd->process_list->current_hash_data = g_new(HashedResourceData**,nb_trace); for(i = 0 ; i < nb_trace ; i++) { - guint num_cpu = ltt_trace_get_num_cpu(tss->parent.traces[i]->t); + guint num_cpu = lttv_trace_get_num_cpu(lttv_traceset_get(ts, i)); cfd->process_list->current_hash_data[i] = g_new(HashedResourceData*,num_cpu); memset(cfd->process_list->current_hash_data[i], 0, sizeof(HashedResourceData*)*num_cpu); @@ -571,7 +571,6 @@ void drawing_chunk_begin(EventsRequest *events_request, LttvTracesetState *tss) void drawing_request_expose(EventsRequest *events_request, - LttvTracesetState *tss, LttTime end_time) { gint x, width; diff --git a/lttv/modules/gui/resourceview/drawing.h b/lttv/modules/gui/resourceview/drawing.h index 8b0070bd..4944e058 100644 --- a/lttv/modules/gui/resourceview/drawing.h +++ b/lttv/modules/gui/resourceview/drawing.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include "cfv.h" @@ -201,12 +200,10 @@ void drawing_remove_square(Drawing_t *drawing, void drawing_update_ruler(Drawing_t *drawing, TimeWindow *time_window); void drawing_request_expose(EventsRequest *events_request, - LttvTracesetState *tss, LttTime end_time); -void drawing_data_request_begin(EventsRequest *events_request, - LttvTracesetState *tss); -void drawing_chunk_begin(EventsRequest *events_request, LttvTracesetState *tss); +void drawing_data_request_begin(EventsRequest *events_request); +void drawing_chunk_begin(EventsRequest *events_request, LttvTraceset *ts); diff --git a/lttv/modules/gui/resourceview/drawitem.c b/lttv/modules/gui/resourceview/drawitem.c index 5397f25b..a9e2cd8a 100644 --- a/lttv/modules/gui/resourceview/drawitem.c +++ b/lttv/modules/gui/resourceview/drawitem.c @@ -106,7 +106,6 @@ #include #include -#include #include #include diff --git a/lttv/modules/gui/resourceview/drawitem.h b/lttv/modules/gui/resourceview/drawitem.h index 28fdc183..1e28f005 100644 --- a/lttv/modules/gui/resourceview/drawitem.h +++ b/lttv/modules/gui/resourceview/drawitem.h @@ -21,6 +21,7 @@ #define _DRAW_ITEM_H #include +#include typedef struct _DrawContext DrawContext; typedef struct _DrawInfo DrawInfo; diff --git a/lttv/modules/gui/resourceview/eventhooks.c b/lttv/modules/gui/resourceview/eventhooks.c index 6b14c07d..49ac5980 100644 --- a/lttv/modules/gui/resourceview/eventhooks.c +++ b/lttv/modules/gui/resourceview/eventhooks.c @@ -116,9 +116,9 @@ static gint background_ready(void *hook_data, void *call_data) */ static void request_background_data(ControlFlowData *resourceview_data) { - LttvTracesetContext * tsc = - lttvwindow_get_traceset_context(resourceview_data->tab); - gint num_traces = lttv_traceset_number(tsc->ts); + LttvTraceset* ts = + lttvwindow_get_traceset(resourceview_data->tab); + gint num_traces = lttv_traceset_number(ts); gint i; LttvTrace *trace; LttvTraceState *tstate; @@ -130,11 +130,10 @@ static void request_background_data(ControlFlowData *resourceview_data) resourceview_data->background_info_waiting = 0; for(i=0;its, i); - tstate = LTTV_TRACE_STATE(tsc->traces[i]); - + trace = lttv_traceset_get(ts, i); + if(lttvwindowtraces_get_ready(g_quark_from_string("state"),trace)==FALSE - && !tstate->has_precomputed_states) { + && !ts->has_precomputed_states) { if(lttvwindowtraces_get_in_progress(g_quark_from_string("state"), trace) == FALSE) { @@ -369,19 +368,17 @@ static void bdev_set_line_color(PropertiesLine *prop_line, LttvBdevState *s) int before_schedchange_hook(void *hook_data, void *call_data) { - LttvTraceHook *th = (LttvTraceHook*)hook_data; - EventsRequest *events_request = (EventsRequest*)th->hook_data; - ControlFlowData *resourceview_data = events_request->viewer_data; - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; + LttvEvent *event; + LttvTraceState *ts; - LttvTracefileState *tfs = (LttvTracefileState *)call_data; - LttvTraceState *ts = (LttvTraceState *)tfc->t_context; + event = (LttvEvent *) call_data; + if (strcmp(lttv_traceset_get_name_from_event(event),"sched_switch") != 0) + return FALSE; - LttEvent *e; - e = ltt_tracefile_get_event(tfc->tf); + ControlFlowData *resourceview_data = (ControlFlowData*)hook_data; - LttTime evtime = ltt_event_time(e); + LttTime evtime = lttv_event_get_timestamp(event); /* we are in a schedchange, before the state update. We must draw the * items corresponding to the state before it changes : now is the right @@ -389,18 +386,18 @@ int before_schedchange_hook(void *hook_data, void *call_data) */ guint pid_out; - pid_out = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); + pid_out = lttv_event_get_long(event, "prev_tid"); // TODO: can't we reenable this? pmf // if(pid_in != 0 && pid_out != 0) { // /* not a transition to/from idle */ // return 0; // } - tfc->target_pid = pid_out; - guint cpu = tfs->cpu; + guint cpu = lttv_traceset_get_cpuid_from_event(event); + ts = event->state; - guint trace_num = ts->parent.index; + guint trace_num = 0;//TODO fdeslauriers 2012-07-17: // Use trace handle to know trace number /* Add process to process list (if not present) */ HashedResourceData *hashed_process_data = NULL; @@ -499,7 +496,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) prop_line.line_width = STATE_LINE_WIDTH; prop_line.style = GDK_LINE_SOLID; prop_line.y = MIDDLE; - cpu_set_line_color(&prop_line, tfs->cpu_state); + cpu_set_line_color(&prop_line, &(ts->cpu_states[cpu])); draw_line((void*)&prop_line, (void*)&draw_context); } @@ -529,23 +526,25 @@ int before_schedchange_hook(void *hook_data, void *call_data) */ int after_schedchange_hook(void *hook_data, void *call_data) { - LttvTraceHook *th = (LttvTraceHook*)hook_data; - EventsRequest *events_request = (EventsRequest*)th->hook_data; - ControlFlowData *resourceview_data = events_request->viewer_data; - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; - LttvTracefileState *tfs = (LttvTracefileState *)call_data; - LttvTraceState *ts = (LttvTraceState *)tfc->t_context; - LttEvent *e; + LttvEvent *event; - e = ltt_tracefile_get_event(tfc->tf); + event = (LttvEvent *) call_data; + + if (strcmp(lttv_traceset_get_name_from_event(event),"sched_switch") != 0) + return FALSE; + + ControlFlowData *resourceview_data = (ControlFlowData*) hook_data; + LttvTraceState *ts = event->state; +#ifdef BABEL_CLEANUP LttvFilter *filter = resourceview_data->filter; if(filter != NULL && filter->head != NULL) if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, tfc->t_context->t,tfc,NULL,NULL)) return FALSE; +#endif - LttTime evtime = ltt_event_time(e); + LttTime evtime = lttv_event_get_timestamp(event); /* Add process to process list (if not present) */ LttvProcessState *process_in; @@ -556,8 +555,8 @@ int after_schedchange_hook(void *hook_data, void *call_data) /* Find process pid_in in the list... */ //process_in = lttv_state_find_process(ts, ANY_CPU, pid_in); //process_in = tfs->process; - guint cpu = tfs->cpu; - guint trace_num = ts->parent.index; + guint cpu = lttv_traceset_get_cpuid_from_event(event); + guint trace_num = 0; /* TODO set right trace number */ process_in = ts->running_process[cpu]; /* It should exist, because we are after the state update. */ #ifdef EXTRA_CHECK @@ -624,33 +623,39 @@ int before_execmode_hook_trap(void *hook_data, void *call_data); int before_execmode_hook(void *hook_data, void *call_data) { - LttvTraceHook *th = (LttvTraceHook*)hook_data; - EventsRequest *events_request = (EventsRequest*)th->hook_data; - ControlFlowData *resourceview_data = events_request->viewer_data; - - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; - - LttvTracefileState *tfs = (LttvTracefileState *)call_data; - LttvTraceState *ts = (LttvTraceState *)tfc->t_context; - - LttEvent *e; - e = ltt_tracefile_get_event(tfc->tf); - - LttTime evtime = ltt_event_time(e); + LttvEvent *event; + guint cpu; + guint pid = 0; + LttvTraceState *ts; + LttvProcessState *process; before_execmode_hook_irq(hook_data, call_data); before_execmode_hook_soft_irq(hook_data, call_data); +#ifdef TRAP_NO_EXIST before_execmode_hook_trap(hook_data, call_data); - +#endif /* we are in a execmode, before the state update. We must draw the * items corresponding to the state before it changes : now is the right * time to do it. */ + event = (LttvEvent *) call_data; + if ((strncmp(lttv_traceset_get_name_from_event(event),"sys_", sizeof("sys_") - 1) == 0) + ||(strcmp(lttv_traceset_get_name_from_event(event),"exit_syscall") == 0) + ||(strncmp(lttv_traceset_get_name_from_event(event),"irq_handler_",sizeof("irq_handler_") -1) == 0) + ||(strncmp(lttv_traceset_get_name_from_event(event),"softirq_", sizeof("softirq_") - 1) == 0)) { + + LttTime evtime = lttv_event_get_timestamp(event); + ControlFlowData *resourceview_data = (ControlFlowData*)hook_data; + /* For the pid */ - guint cpu = tfs->cpu; + LttvTraceset *traceSet = lttvwindow_get_traceset(resourceview_data->tab); + + cpu = lttv_traceset_get_cpuid_from_event(event); + ts = event->state; + + guint trace_num = 0;//TODO fdeslauriers 2012-07-17: // Use trace handle to know trace number - guint trace_num = ts->parent.index; - LttvProcessState *process = ts->running_process[cpu]; + process = ts->running_process[cpu]; g_assert(process != NULL); /* Well, the process_out existed : we must get it in the process hash @@ -767,7 +772,7 @@ int before_execmode_hook(void *hook_data, void *call_data) prop_line.line_width = STATE_LINE_WIDTH; prop_line.style = GDK_LINE_SOLID; prop_line.y = MIDDLE; - cpu_set_line_color(&prop_line, tfs->cpu_state); + cpu_set_line_color(&prop_line, &ts->cpu_states[cpu]); draw_line((void*)&prop_line, (void*)&draw_context); } /* become the last x position */ @@ -779,27 +784,19 @@ int before_execmode_hook(void *hook_data, void *call_data) convert_pixels_to_time(width, x+1, time_window, &hashed_process_data->next_good_time); } + } } - return 0; } int before_execmode_hook_irq(void *hook_data, void *call_data) { - LttvTraceHook *th = (LttvTraceHook*)hook_data; - EventsRequest *events_request = (EventsRequest*)th->hook_data; - ControlFlowData *resourceview_data = events_request->viewer_data; - - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; - - LttvTracefileState *tfs = (LttvTracefileState *)call_data; - LttvTraceState *ts = (LttvTraceState *)tfc->t_context; - struct marker_info *minfo; + LttvEvent *event; - LttEvent *e; - e = ltt_tracefile_get_event(tfc->tf); - - LttTime evtime = ltt_event_time(e); + event = (LttvEvent *) call_data; + + LttTime evtime = lttv_event_get_timestamp(event); + ControlFlowData *resourceview_data = (ControlFlowData*)hook_data; /* we are in a execmode, before the state update. We must draw the * items corresponding to the state before it changes : now is the right @@ -808,19 +805,17 @@ int before_execmode_hook_irq(void *hook_data, void *call_data) /* For the pid */ guint64 irq; - guint cpu = tfs->cpu; + guint cpu = lttv_traceset_get_cpuid_from_event(event); + LttvTraceset *traceSet = lttvwindow_get_traceset(resourceview_data->tab); + LttvTraceState *ts = event->state;; /* * Check for LTT_CHANNEL_KERNEL channel name and event ID * corresponding to LTT_EVENT_IRQ_ENTRY or LTT_EVENT_IRQ_EXIT. */ - if (tfc->tf->name != LTT_CHANNEL_KERNEL) - return 0; - minfo = marker_get_info_from_id(tfc->tf->mdata, e->event_id); - g_assert(minfo != NULL); - if (minfo->name == LTT_EVENT_IRQ_ENTRY) { - irq = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); - } else if (minfo->name == LTT_EVENT_IRQ_EXIT) { + if (strncmp(lttv_traceset_get_name_from_event(event),"irq_handler_entry",sizeof("irq_handler_entry")) == 0) { + irq = lttv_event_get_long(event, "irq"); + } else if (strncmp(lttv_traceset_get_name_from_event(event),"irq_handler_exit",sizeof("irq_handler_exit")) == 0) { gint len = ts->cpu_states[cpu].irq_stack->len; if(len) { irq = g_array_index(ts->cpu_states[cpu].irq_stack, gint, len-1); @@ -831,7 +826,7 @@ int before_execmode_hook_irq(void *hook_data, void *call_data) } else return 0; - guint trace_num = ts->parent.index; + guint trace_num = 0;//TODO fdeslauriers 2012-07-17: // Use trace handle to know trace number /* Well, the process_out existed : we must get it in the process hash * or add it, and draw its items. @@ -967,20 +962,14 @@ int before_execmode_hook_irq(void *hook_data, void *call_data) int before_execmode_hook_soft_irq(void *hook_data, void *call_data) { - LttvTraceHook *th = (LttvTraceHook*)hook_data; - EventsRequest *events_request = (EventsRequest*)th->hook_data; - ControlFlowData *resourceview_data = events_request->viewer_data; - - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; - - LttvTracefileState *tfs = (LttvTracefileState *)call_data; - LttvTraceState *ts = (LttvTraceState *)tfc->t_context; - struct marker_info *minfo; - LttEvent *e; - e = ltt_tracefile_get_event(tfc->tf); + LttvEvent *event; + LttvTraceState *ts; - LttTime evtime = ltt_event_time(e); + event = (LttvEvent *) call_data; + + + /* we are in a execmode, before the state update. We must draw the * items corresponding to the state before it changes : now is the right @@ -989,21 +978,23 @@ int before_execmode_hook_soft_irq(void *hook_data, void *call_data) /* For the pid */ guint64 softirq; - guint cpu = tfs->cpu; + /* * Check for LTT_CHANNEL_KERNEL channel name and event ID * corresponding to LTT_EVENT_SOFT_IRQ_RAISE, LTT_EVENT_SOFT_IRQ_ENTRY * or LTT_EVENT_SOFT_IRQ_EXIT. */ - if (tfc->tf->name != LTT_CHANNEL_KERNEL) - return 0; - minfo = marker_get_info_from_id(tfc->tf->mdata, e->event_id); - g_assert(minfo != NULL); - if (minfo->name == LTT_EVENT_SOFT_IRQ_RAISE - || minfo->name == LTT_EVENT_SOFT_IRQ_ENTRY) { - softirq = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); - } else if (minfo->name == LTT_EVENT_SOFT_IRQ_EXIT) { + + if (strncmp(lttv_traceset_get_name_from_event(event),"softirq_entry",sizeof("softirq_entry")) == 0 + || strncmp(lttv_traceset_get_name_from_event(event),"softirq_raise",sizeof("softirq_raise")) == 0) { + softirq = lttv_event_get_long_unsigned(event, "vec"); + } else if (strncmp(lttv_traceset_get_name_from_event(event),"softirq_exit",sizeof("softirq_exit")) == 0) { + LttTime evtime = lttv_event_get_timestamp(event); + ControlFlowData *resourceview_data = (ControlFlowData*)hook_data; + LttvTraceset *traceSet = lttvwindow_get_traceset(resourceview_data->tab); + guint cpu = lttv_traceset_get_cpuid_from_event(event); + ts = event->state; gint len = ts->cpu_states[cpu].softirq_stack->len; if(len) { softirq = g_array_index(ts->cpu_states[cpu].softirq_stack, gint, len-1); @@ -1011,10 +1002,9 @@ int before_execmode_hook_soft_irq(void *hook_data, void *call_data) else { return 0; } - } else - return 0; - guint trace_num = ts->parent.index; + + guint trace_num = 0;//TODO change it to the right value; /* Well, the process_out existed : we must get it in the process hash * or add it, and draw its items. @@ -1134,10 +1124,10 @@ int before_execmode_hook_soft_irq(void *hook_data, void *call_data) &hashed_process_data->next_good_time); } } - + } return 0; } - +#ifdef TRAP_NO_EXIST int before_execmode_hook_trap(void *hook_data, void *call_data) { LttvTraceHook *th = (LttvTraceHook*)hook_data; @@ -1313,34 +1303,38 @@ int before_execmode_hook_trap(void *hook_data, void *call_data) return 0; } - - +#endif +#ifdef BABEL_CLEANUP +//TODO investigate the use of block dev resource int before_bdev_event_hook(void *hook_data, void *call_data) { - LttvTraceHook *th = (LttvTraceHook*)hook_data; - EventsRequest *events_request = (EventsRequest*)th->hook_data; - ControlFlowData *resourceview_data = events_request->viewer_data; +LttvEvent *event; + guint cpu; + guint pid = 0; + LttvTraceState *ts; + LttvProcessState *process; - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; - - LttvTraceState *ts = (LttvTraceState *)tfc->t_context; - - LttEvent *e; - e = ltt_tracefile_get_event(tfc->tf); - - LttTime evtime = ltt_event_time(e); /* we are in a execmode, before the state update. We must draw the * items corresponding to the state before it changes : now is the right * time to do it. */ + + event = (LttvEvent *) call_data; + if (strcmp(lttv_traceset_get_name_from_event(event),"block_rq_issue") != 0 && strcmp(lttv_traceset_get_name_from_event(event),"block_rq_complete") != 0) + return FALSE; + + + ControlFlowData *resourceview_data = (ControlFlowData*) hook_data; + + LttvTraceState *ts = event->state; /* For the pid */ 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)); gint devcode_gint = MKDEV(major,minor); - guint trace_num = ts->parent.index; + guint trace_num = 0; //TODO put the real trace_num; LttvBdevState *bdev = g_hash_table_lookup(ts->bdev_states, &devcode_gint); /* the result of the lookup might be NULL. that's ok, the rest of the function @@ -1482,7 +1476,7 @@ int before_bdev_event_hook(void *hook_data, void *call_data) return 0; } - +#endif gint update_time_window_hook(void *hook_data, void *call_data) { ControlFlowData *resourceview_data = (ControlFlowData*) hook_data; @@ -1780,11 +1774,11 @@ gint update_current_time_hook(void *hook_data, void *call_data) } LttTime time_end = ltt_time_add(time_begin, width); - LttvTracesetContext * tsc = - lttvwindow_get_traceset_context(resourceview_data->tab); - - LttTime trace_start = tsc->time_span.start_time; - LttTime trace_end = tsc->time_span.end_time; + LttvTraceset * ts = lttvwindow_get_traceset(resourceview_data->tab); + + TimeInterval time_span = lttv_traceset_get_time_span_real(ts); + LttTime trace_start = time_span.start_time; + LttTime trace_end = time_span.end_time; g_info("New current time HOOK : %lu, %lu", current_time.tv_sec, current_time.tv_nsec); @@ -1844,7 +1838,6 @@ gint update_current_time_hook(void *hook_data, void *call_data) typedef struct _ClosureData { EventsRequest *events_request; - LttvTracesetState *tss; LttTime end_time; guint x_end; } ClosureData; @@ -1859,9 +1852,7 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data) EventsRequest *events_request = closure_data->events_request; ControlFlowData *resourceview_data = events_request->viewer_data; - - LttvTracesetState *tss = closure_data->tss; - LttvTracesetContext *tsc = (LttvTracesetContext*)tss; + LttvTraceset *ts = lttvwindow_get_traceset(resourceview_data->tab); LttTime evtime = closure_data->end_time; @@ -1880,8 +1871,9 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data) #ifdef EXTRA_CHECK g_assert(lttv_traceset_number(tsc->ts) > 0); #endif //EXTRA_CHECK - LttvTraceContext *tc = tsc->traces[process_info->trace_num]; - LttvTraceState *ts = (LttvTraceState*)tc; + //TODO Fdeslauriers 2012-07-17: adapt for multiple traces + LttvTrace *trace = lttv_traceset_get(ts,0); + LttvTraceState *ts = trace->state; /* Only draw for processes that are currently in the trace states */ @@ -2004,7 +1996,8 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data) int before_chunk(void *hook_data, void *call_data) { EventsRequest *events_request = (EventsRequest*)hook_data; - LttvTracesetState *tss = (LttvTracesetState*)call_data; + LttvTraceset *ts = (LttvTraceset*)call_data; + #if 0 /* Deactivate sort */ gtk_tree_sortable_set_sort_column_id( @@ -2012,7 +2005,7 @@ int before_chunk(void *hook_data, void *call_data) TRACE_COLUMN, GTK_SORT_ASCENDING); #endif //0 - drawing_chunk_begin(events_request, tss); + drawing_chunk_begin(events_request, ts); return 0; } @@ -2025,37 +2018,21 @@ int before_chunk(void *hook_data, void *call_data) int before_request(void *hook_data, void *call_data) { EventsRequest *events_request = (EventsRequest*)hook_data; - LttvTracesetState *tss = (LttvTracesetState*)call_data; - drawing_data_request_begin(events_request, tss); + drawing_data_request_begin(events_request); return 0; } - -/* - * after request is necessary in addition of after chunk in order to draw - * lines until the end of the screen. after chunk just draws lines until - * the last event. - * - * for each process - * draw closing line - * expose - */ -int after_request(void *hook_data, void *call_data) +void draw_closing_lines(ControlFlowData *resourceview_data, + EventsRequest* events_request) { - guint i; - EventsRequest *events_request = (EventsRequest*)hook_data; - ControlFlowData *resourceview_data = events_request->viewer_data; - LttvTracesetState *tss = (LttvTracesetState*)call_data; - - LttTime end_time = events_request->end_time; - + LttTime end_time = events_request->end_time; ClosureData closure_data; - closure_data.events_request = (EventsRequest*)hook_data; - closure_data.tss = tss; + closure_data.events_request = events_request; closure_data.end_time = end_time; + TimeWindow time_window = lttvwindow_get_time_window(resourceview_data->tab); guint width = resourceview_data->drawing->width; @@ -2065,7 +2042,7 @@ int after_request(void *hook_data, void *call_data) width, &closure_data.x_end); - + guint i; /* Draw last items */ for(i=0; iviewer_data; + + draw_closing_lines(resourceview_data, events_request); + return 0; } @@ -2086,15 +2082,13 @@ int after_chunk(void *hook_data, void *call_data) { EventsRequest *events_request = (EventsRequest*)hook_data; ControlFlowData *resourceview_data = events_request->viewer_data; - LttvTracesetState *tss = (LttvTracesetState*)call_data; - LttvTracesetContext *tsc = (LttvTracesetContext*)call_data; - LttvTracefileContext *tfc = lttv_traceset_context_get_current_tfc(tsc); + LttvTraceset *ts = (LttvTraceset*)call_data; + LttTime end_time; ProcessList *process_list = resourceview_data->process_list; guint i; - LttvTraceset *traceset = tsc->ts; - guint nb_trace = lttv_traceset_number(traceset); + guint nb_trace = lttv_traceset_number(ts); /* Only execute when called for the first trace's events request */ if(!process_list->current_hash_data) @@ -2105,44 +2099,13 @@ int after_chunk(void *hook_data, void *call_data) } g_free(process_list->current_hash_data); process_list->current_hash_data = NULL; - +#ifdef BABEL_CLEANUP if(tfc != NULL) end_time = LTT_TIME_MIN(tfc->timestamp, events_request->end_time); else /* end of traceset, or position now out of request : end */ end_time = events_request->end_time; - - ClosureData closure_data; - closure_data.events_request = (EventsRequest*)hook_data; - closure_data.tss = tss; - closure_data.end_time = end_time; - - TimeWindow time_window = - lttvwindow_get_time_window(resourceview_data->tab); - guint width = resourceview_data->drawing->width; - convert_time_to_pixels( - time_window, - end_time, - width, - &closure_data.x_end); - - /* Draw last items */ - for(i=0; iprocess_list->list_store), - GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, - GTK_SORT_ASCENDING); - - update_index_to_pixmap(resourceview_data->process_list); - /* Request a full expose : drawing scrambled */ - gtk_widget_queue_draw(resourceview_data->drawing->drawing_area); -#endif //0 - /* Request expose (updates damages zone also) */ - drawing_request_expose(events_request, tss, end_time); +#endif + draw_closing_lines(resourceview_data, events_request); return 0; } @@ -2157,30 +2120,39 @@ int after_chunk(void *hook_data, void *call_data) */ int before_statedump_end(void *hook_data, void *call_data) { - gint i; + LttvEvent *event; - LttvTraceHook *th = (LttvTraceHook*)hook_data; - EventsRequest *events_request = (EventsRequest*)th->hook_data; - ControlFlowData *resourceview_data = events_request->viewer_data; + event = (LttvEvent *) call_data; + + if (strcmp(lttv_traceset_get_name_from_event(event),"lttng_statedump_end") != 0) + return FALSE; - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; + ControlFlowData *resourceview_data = (ControlFlowData*) hook_data; - LttvTracesetState *tss = (LttvTracesetState*)tfc->t_context->ts_context; - LttEvent *e; - e = ltt_tracefile_get_event(tfc->tf); + LttvTraceState *ts = event->state; + + + gint i; + +#ifdef BABEL_CLEANUP LttvFilter *filter = resourceview_data->filter; if(filter != NULL && filter->head != NULL) if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, tfc->t_context->t,tfc,NULL,NULL)) return FALSE; +#endif - LttTime evtime = ltt_event_time(e); + LttTime evtime = lttv_event_get_timestamp(event); ClosureData closure_data; - closure_data.events_request = events_request; - closure_data.tss = tss; + //TODO ybrosseau 2013-03-27: Fake and event_request. + // We need to change the API of drawing_request_expose to ask + // For and control flow data only. + EventsRequest events_request; + events_request.viewer_data = resourceview_data; + closure_data.events_request = &events_request; closure_data.end_time = evtime; TimeWindow time_window = @@ -2210,7 +2182,8 @@ int before_statedump_end(void *hook_data, void *call_data) gtk_widget_queue_draw(resourceview_data->drawing->drawing_area); #endif //0 /* Request expose (updates damages zone also) */ - drawing_request_expose(events_request, tss, evtime); + drawing_request_expose(&events_request, evtime); return 0; + } diff --git a/lttv/modules/gui/resourceview/lttv_plugin_cfv.c b/lttv/modules/gui/resourceview/lttv_plugin_cfv.c index b9ab49f9..81030335 100644 --- a/lttv/modules/gui/resourceview/lttv_plugin_cfv.c +++ b/lttv/modules/gui/resourceview/lttv_plugin_cfv.c @@ -34,7 +34,9 @@ static void cfv_update_filter(LttvPlugin *parent, LttvFilter *filter) { LttvPluginCFV *self = LTTV_PLUGIN_CFV(parent); g_message("In CFV update filter."); +#ifdef BABEL_CLEANUP lttv_filter_destroy(self->cfd->filter); +#endif //babel_cleanup self->cfd->filter = filter; redraw_notify(self->cfd, NULL); } diff --git a/runlttv b/runlttv index 8392d599..70e9bf55 100755 --- a/runlttv +++ b/runlttv @@ -14,14 +14,15 @@ PROGNAME=$0 BUILDPATH=$(dirname $0) RCFILE="$(dirname $0)/.runlttvrc" TEXTLIBS="-L ${BUILDPATH}/lttv/modules/text/.libs -m textDump" +FORMATEDLIBS="-L ${BUILDPATH}/lttv/modules/text/.libs -m formatedDump" EVALLIBS="-L ${BUILDPATH}/lttv/modules/text/.libs -m sync_chain_batch" GRAPHLIBS="-L ${BUILDPATH}/lttv/modules/gui/lttvwindow/lttvwindow/.libs -m lttvwindow "\ "-L ${BUILDPATH}/lttv/modules/gui/detailedevents/.libs -m guievents "\ "-L ${BUILDPATH}/lttv/modules/gui/histogram/.libs -m guihistogram "\ +"-L ${BUILDPATH}/lttv/modules/gui/resourceview/.libs -m resourceview "\ "-L ${BUILDPATH}/lttv/modules/gui/controlflow/.libs -m guicontrolflow" #"-L ${BUILDPATH}/lttv/modules/gui/tracecontrol/.libs -m guitracecontrol "\ #"-L ${BUILDPATH}/lttv/modules/gui/statistics/.libs -m guistatistics "\ -#"-L ${BUILDPATH}/lttv/modules/gui/resourceview/.libs -m resourceview "\ #"-L ${BUILDPATH}/lttv/modules/gui/filter/.libs -m guifilter "\ #"-L ${BUILDPATH}/lttv/modules/gui/interrupts/.libs -m interrupts " @@ -79,6 +80,8 @@ fi if [ "$MODE" = "text" ]; then LIBS="$TEXTLIBS" +elif [ "$MODE" = "format" ]; then + LIBS="$FORMATLIBS" elif [ "$MODE" = "eval" ]; then LIBS="$EVALLIBS" elif [ "$MODE" = "gui" ]; then