X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Fcontrolflow%2Feventhooks.c;h=ed2e3309447c13e5281b267a82b1f7d865524f1d;hb=c8bba5fa123e79c25c3ed0f6355f511ed84b88b2;hp=cb1121acd7fb77a91d0e2ddbd43a119c3c655711;hpb=b9a010a28d9625c9d31968aa44f1a553daccb294;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index cb1121ac..ed2e3309 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -279,6 +279,66 @@ int event_selected_hook(void *hook_data, void *call_data) } + +static __inline PropertiesLine prepare_line(LttvProcessState *process) +{ + PropertiesLine prop_line; + prop_line.line_width = 2; + prop_line.style = GDK_LINE_SOLID; + prop_line.position = MIDDLE; + + g_debug("prepare_line for state : %s", g_quark_to_string(process->state->s)); + + /* color of line : status of the process */ + if(process->state->s == LTTV_STATE_UNNAMED) + { + prop_line.color.red = 0xffff; + prop_line.color.green = 0xffff; + prop_line.color.blue = 0xffff; + } + else if(process->state->s == LTTV_STATE_WAIT_FORK) + { + prop_line.color.red = 0x0fff; + prop_line.color.green = 0xffff; + prop_line.color.blue = 0xfff0; + } + else if(process->state->s == LTTV_STATE_WAIT_CPU) + { + prop_line.color.red = 0xffff; + prop_line.color.green = 0xffff; + prop_line.color.blue = 0x0000; + } + else if(process->state->s == LTTV_STATE_EXIT) + { + prop_line.color.red = 0xffff; + prop_line.color.green = 0x0000; + prop_line.color.blue = 0xffff; + } + else if(process->state->s == LTTV_STATE_WAIT) + { + prop_line.color.red = 0xffff; + prop_line.color.green = 0x0000; + prop_line.color.blue = 0x0000; + } + else if(process->state->s == LTTV_STATE_RUN) + { + prop_line.color.red = 0x0000; + prop_line.color.green = 0xffff; + prop_line.color.blue = 0x0000; + } + else + { + prop_line.color.red = 0xffff; + prop_line.color.green = 0xffff; + prop_line.color.blue = 0xffff; + } + + return prop_line; + +} + + + /* draw_before_hook * * This function basically draw lines and icons. Two types of lines are drawn : @@ -301,6 +361,7 @@ int draw_before_hook(void *hook_data, void *call_data) { EventsRequest *events_request = (EventsRequest*)hook_data; ControlFlowData *control_flow_data = events_request->viewer_data; + Drawing_t *drawing = control_flow_data->drawing; LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; @@ -321,7 +382,7 @@ int draw_before_hook(void *hook_data, void *call_data) || ltt_time_compare(evtime, end_time) == 1) return; - guint width = control_flow_data->drawing->width; + guint width = drawing->width; if(strcmp(ltt_eventtype_name(ltt_event_eventtype(e)),"schedchange") == 0) { @@ -355,7 +416,7 @@ int draw_before_hook(void *hook_data, void *call_data) * or add it, and draw its items. */ /* Add process to process list (if not present) */ - guint y_out = 0, height = 0, pl_height = 0; + guint y = 0, height = 0, pl_height = 0; HashedProcessData *hashed_process_data = NULL; ProcessList *process_list = guicontrolflow_get_process_list(control_flow_data); @@ -366,7 +427,7 @@ int draw_before_hook(void *hook_data, void *call_data) pid_out, &birth, tfc->t_context->index, - &y_out, + &y, &height, &hashed_process_data) == 1) { @@ -382,10 +443,10 @@ int draw_before_hook(void *hook_data, void *call_data) pid_out, &birth, tfc->t_context->index, - &y_out, + &y, &height, &hashed_process_data); - drawing_insert_square( control_flow_data->drawing, y_out, height); + drawing_insert_square( drawing, y, height); } /* Now, the process is in the state hash and our own process hash. @@ -398,8 +459,39 @@ int draw_before_hook(void *hook_data, void *call_data) * value. */ g_assert(hashed_process_data->x != -1); - - + { + guint x; + DrawContext draw_context; + + convert_time_to_pixels( + time_window.start_time, + end_time, + evtime, + width, + &x); + + /* Now create the drawing context that will be used to draw + * items related to the last state. */ + draw_context.drawable = drawing->pixmap; + draw_context.gc = drawing->gc; + draw_context.pango_layout = drawing->pango_layout; + draw_context.drawinfo.x_start = hashed_process_data->x; + draw_context.drawinfo.x_end = x; + + draw_context.drawinfo.y_over = y; + draw_context.drawinfo.y_middle = y+(height/4); + draw_context.drawinfo.y_under = y+(height/2)+2; + + draw_context.drawinfo.x_modify_over = hashed_process_data->x; + draw_context.drawinfo.x_modify_middle = hashed_process_data->x; + draw_context.drawinfo.x_modify_under = hashed_process_data->x; + + { + /* Draw the line */ + PropertiesLine prop_line = prepare_line(process); + draw_line((void*)&prop_line, (void*)&draw_context); + } + } } } @@ -407,7 +499,6 @@ int draw_before_hook(void *hook_data, void *call_data) return 0; - #if 0 EventsRequest *events_request = (EventsRequest*)hook_data; ControlFlowData *control_flow_data = @@ -2277,11 +2368,12 @@ int after_chunk(void *hook_data, void *call_data) ProcessList *process_list = guicontrolflow_get_process_list(control_flow_data); - if(tfc != NULL) + if(tfc != NULL + && ltt_time_compare(tfc->timestamp, events_request->end_time) <= 0) end_time = tfc->timestamp; - else /* end of traceset */ - end_time = tsc->time_span.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;