From d0cd7f0949c2fd90d5a39361b192c9b2d96bf5d4 Mon Sep 17 00:00:00 2001 From: compudj Date: Wed, 4 Feb 2004 16:07:15 +0000 Subject: [PATCH] multiple traces/tracefiles change git-svn-id: http://ltt.polymtl.ca/svn@480 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/include/lttv/state.h | 4 +- ltt/branches/poly/lttv/main/state.c | 62 ++++ .../lttv/modules/gui/controlflow/drawing.c | 14 +- .../lttv/modules/gui/controlflow/drawitem.c | 15 +- .../lttv/modules/gui/controlflow/eventhooks.c | 296 +++++++++++++++--- .../modules/gui/controlflow/processlist.c | 55 +++- .../modules/gui/controlflow/processlist.h | 9 +- 7 files changed, 396 insertions(+), 59 deletions(-) diff --git a/ltt/branches/poly/include/lttv/state.h b/ltt/branches/poly/include/lttv/state.h index 8131bb8b..4205c27c 100644 --- a/ltt/branches/poly/include/lttv/state.h +++ b/ltt/branches/poly/include/lttv/state.h @@ -140,8 +140,9 @@ typedef struct _LttvProcessState { /* opened file descriptors, address map?... */ } LttvProcessState; - +//FIXME : find by pid and birth time : both are necessary to be unique LttvProcessState *lttv_state_find_process(LttvTracefileState *tfs, guint pid); +LttvProcessState *lttv_state_find_process_from_trace(LttvTraceState *ts, guint pid); /* The LttvTracesetState, LttvTraceState and LttvTracefileState types @@ -183,6 +184,7 @@ struct _LttvTraceState { GQuark *trap_names; GQuark *irq_names; gboolean recompute_state_in_seek; + gboolean saved_state_ready; gboolean saved_state_available; }; diff --git a/ltt/branches/poly/lttv/main/state.c b/ltt/branches/poly/lttv/main/state.c index f9d123e0..2fb45279 100644 --- a/ltt/branches/poly/lttv/main/state.c +++ b/ltt/branches/poly/lttv/main/state.c @@ -61,6 +61,9 @@ static void lttv_state_free_process_table(GHashTable *processes); static LttvProcessState *create_process(LttvTracefileState *tfs, LttvProcessState *parent, guint pid); +static LttvProcessState *create_process_from_trace(LttvTraceState *ts, + LttvProcessState *parent, guint pid); + void lttv_state_save(LttvTraceState *self, LttvAttribute *container) { LTTV_TRACE_STATE_GET_CLASS(self)->state_save(self, container); @@ -585,6 +588,54 @@ static LttvProcessState *create_process(LttvTracefileState *tfs, return process; } +static LttvProcessState *create_process_from_trace(LttvTraceState *tcs, + LttvProcessState *parent, guint pid) +{ + LttvProcessState *process = g_new(LttvProcessState, 1); + + LttvExecutionState *es; + + LttvTraceContext *tc = (LttvTraceContext *)tcs; + + char buffer[128]; + + g_hash_table_insert(tcs->processes, GUINT_TO_POINTER(pid), process); + process->pid = pid; + + if(parent) { + process->ppid = parent->pid; + process->name = parent->name; + } + else { + process->ppid = 0; + process->name = LTTV_STATE_UNNAMED; + } + + //FIXME timestamp should come from trace + process->creation_time.tv_sec = 0; + process->creation_time.tv_nsec = 0; + sprintf(buffer,"%d-%lu.%lu",pid, process->creation_time.tv_sec, + process->creation_time.tv_nsec); + process->pid_time = g_quark_from_string(buffer); + process->execution_stack = g_array_new(FALSE, FALSE, + sizeof(LttvExecutionState)); + g_array_set_size(process->execution_stack, 1); + es = process->state = &g_array_index(process->execution_stack, + LttvExecutionState, 0); + es->t = LTTV_STATE_USER_MODE; + es->n = LTTV_STATE_SUBMODE_NONE; + //FIXME es->entry = tfs->parent.timestamp; + es->entry.tv_sec = 0; + es->entry.tv_nsec = 0; + //FIXME es->change = tfs->parent.timestamp; + es->change.tv_sec = 0; + es->change.tv_nsec = 0; + es->s = LTTV_STATE_WAIT_FORK; + + return process; +} + + LttvProcessState *lttv_state_find_process(LttvTracefileState *tfs, guint pid) @@ -596,6 +647,17 @@ LttvProcessState *lttv_state_find_process(LttvTracefileState *tfs, return process; } +LttvProcessState *lttv_state_find_process_from_trace(LttvTraceState *ts, + guint pid) +{ + LttvProcessState *process = g_hash_table_lookup(ts->processes, + GUINT_TO_POINTER(pid)); + + if(process == NULL) process = create_process_from_trace(ts, NULL, pid); + return process; +} + + static void exit_process(LttvTracefileState *tfs, LttvProcessState *process) { diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c index 6edf5668..2a435013 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c @@ -108,7 +108,7 @@ void drawing_data_request(Drawing_t *drawing, LttvTracesetContext * tsc = get_traceset_context(control_flow_data->mw); LttvTracesetState * tss = - LTTV_TRACESET_STATE(tsc); + (LttvTracesetState*)tsc; //send_test_process( //guicontrolflow_get_process_list(drawing->control_flow_data), @@ -145,15 +145,15 @@ void drawing_data_request(Drawing_t *drawing, // FIXME : would like to place the after_traceset hook after the traceset, // but the traceset context state is not valid anymore. lttv_traceset_context_add_hooks(tsc, - // NULL, after_traceset, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, - NULL, after_traceset, NULL, event, after_event); + NULL, after_traceset, NULL, NULL, NULL, NULL, + //NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, event, after_event); lttv_process_traceset(tsc, end, G_MAXULONG); //after_data_request((void*)&event_request,(void*)tsc); lttv_traceset_context_remove_hooks(tsc, - //NULL, after_traceset, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, - NULL, after_traceset, NULL, event, after_event); + NULL, after_traceset, NULL, NULL, NULL, NULL, + // NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, event, after_event); //Modified by xiangxiu: state update hooks are removed by the main window //state_remove_event_hooks_api(control_flow_data->mw); diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.c b/ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.c index b2b8fb97..6d535fa5 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawitem.c @@ -265,6 +265,11 @@ gboolean draw_line( void *hook_data, void *call_data) Properties->style, GDK_CAP_BUTT, GDK_JOIN_MITER); + //g_critical("DRAWING LINE : x1: %i, y1: %i, x2:%i, y2:%i", + // Draw_Context->previous->middle->x, + // Draw_Context->previous->middle->y, + // Draw_Context->current->middle->x, + // Draw_Context->current->middle->y); switch(Properties->position) { case OVER: @@ -351,13 +356,19 @@ gboolean draw_bg( void *hook_data, void *call_data) //gdk_gc_set_foreground(Draw_Context->gc, Properties->color); gdk_gc_set_rgb_fg_color(Draw_Context->gc, Properties->color); - + //g_critical("DRAWING RECT : x: %i, y: %i, w:%i, h:%i, val1 :%i, val2:%i ", + // Draw_Context->previous->over->x, + // Draw_Context->previous->over->y, + // Draw_Context->current->over->x - Draw_Context->previous->over->x, + // Draw_Context->previous->under->y-Draw_Context->previous->over->y, + // Draw_Context->current->over->x, + // Draw_Context->previous->over->x); gdk_draw_rectangle(Draw_Context->drawable, Draw_Context->gc, TRUE, Draw_Context->previous->over->x, Draw_Context->previous->over->y, Draw_Context->current->over->x - Draw_Context->previous->over->x, - Draw_Context->previous->under->y); + Draw_Context->previous->under->y-Draw_Context->previous->over->y); return 0; } diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index 9beac5d4..8a5c6b9a 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -203,6 +203,7 @@ int draw_event_hook(void *hook_data, void *call_data) if(processlist_get_process_pixels(process_list, pid_out, &birth, + tfc->t_context->index, &y_out, &height, &hashed_process_data_out) == 1) @@ -211,12 +212,14 @@ int draw_event_hook(void *hook_data, void *call_data) processlist_add(process_list, pid_out, &birth, + tfc->t_context->index, name, &pl_height, &hashed_process_data_out); processlist_get_process_pixels(process_list, pid_out, &birth, + tfc->t_context->index, &y_out, &height, &hashed_process_data_out); @@ -236,6 +239,7 @@ int draw_event_hook(void *hook_data, void *call_data) if(processlist_get_process_pixels(process_list, pid_in, &birth, + tfc->t_context->index, &y_in, &height, &hashed_process_data_in) == 1) @@ -244,12 +248,14 @@ int draw_event_hook(void *hook_data, void *call_data) processlist_add(process_list, pid_in, &birth, + tfc->t_context->index, name, &pl_height, &hashed_process_data_in); processlist_get_process_pixels(process_list, pid_in, &birth, + tfc->t_context->index, &y_in, &height, &hashed_process_data_in); @@ -289,13 +295,79 @@ int draw_event_hook(void *hook_data, void *call_data) draw_context_out->pango_layout = control_flow_data->drawing->pango_layout; GtkWidget *widget = control_flow_data->drawing->drawing_area; //draw_context_out->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; - draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap); - gdk_gc_copy(draw_context_out->gc, widget->style->black_gc); + //draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap); + //gdk_gc_copy(draw_context_out->gc, widget->style->black_gc); //draw_context_out->gc = widget->style->black_gc; //draw_arc((void*)&prop_arc, (void*)draw_context_out); //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap); + /* Draw the line/background of the out process */ + if(draw_context_out->previous->middle->x == -1) + { + draw_context_out->previous->over->x = event_request->x_begin; + draw_context_out->previous->middle->x = event_request->x_begin; + draw_context_out->previous->under->x = event_request->x_begin; + + g_critical("out middle x_beg : %u",event_request->x_begin); + } + + draw_context_out->current->middle->x = x; + draw_context_out->current->over->x = x; + draw_context_out->current->under->x = x; + draw_context_out->current->middle->y = y_out + height/2; + draw_context_out->current->over->y = y_out; + draw_context_out->current->under->y = y_out + height; + draw_context_out->previous->middle->y = y_out + height/2; + draw_context_out->previous->over->y = y_out; + draw_context_out->previous->under->y = y_out + height; + + draw_context_out->drawable = control_flow_data->drawing->pixmap; + draw_context_out->pango_layout = control_flow_data->drawing->pango_layout; + + if(process_out->state->s == LTTV_STATE_RUN) + { + draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap); + gdk_gc_copy(draw_context_out->gc, widget->style->black_gc); + + PropertiesBG prop_bg; + prop_bg.color = g_new(GdkColor,1); + + switch(tfc->index) { + case 0: + prop_bg.color->red = 0x1515; + prop_bg.color->green = 0x1515; + prop_bg.color->blue = 0x8c8c; + break; + case 1: + prop_bg.color->red = 0x4e4e; + prop_bg.color->green = 0xa9a9; + prop_bg.color->blue = 0xa4a4; + break; + case 2: + prop_bg.color->red = 0x7a7a; + prop_bg.color->green = 0x4a4a; + prop_bg.color->blue = 0x8b8b; + break; + case 3: + prop_bg.color->red = 0x8080; + prop_bg.color->green = 0x7777; + prop_bg.color->blue = 0x4747; + break; + default: + prop_bg.color->red = 0xe7e7; + prop_bg.color->green = 0xe7e7; + prop_bg.color->blue = 0xe7e7; + } + + g_critical("calling from draw_event"); + draw_bg((void*)&prop_bg, (void*)draw_context_out); + g_free(prop_bg.color); + gdk_gc_unref(draw_context_out->gc); + } + + draw_context_out->gc = widget->style->black_gc; + GdkColor colorfg_out = { 0, 0xffff, 0x0000, 0x0000 }; GdkColor colorbg_out = { 0, 0x0000, 0x0000, 0x0000 }; PropertiesText prop_text_out; @@ -366,21 +438,8 @@ int draw_event_hook(void *hook_data, void *call_data) prop_text_out.text = "U"; draw_text((void*)&prop_text_out, (void*)draw_context_out); - gdk_gc_unref(draw_context_out->gc); + //gdk_gc_unref(draw_context_out->gc); - /* Draw the line of the out process */ - if(draw_context_out->previous->middle->x == -1) - { - draw_context_out->previous->middle->x = event_request->x_begin; - g_critical("out middle x_beg : %u",event_request->x_begin); - } - - draw_context_out->current->middle->x = x; - draw_context_out->current->middle->y = y_out + height/2; - draw_context_out->previous->middle->y = y_out + height/2; - draw_context_out->drawable = control_flow_data->drawing->pixmap; - draw_context_out->pango_layout = control_flow_data->drawing->pango_layout; - //draw_context_out->gc = widget->style->black_gc; draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap); gdk_gc_copy(draw_context_out->gc, widget->style->black_gc); @@ -453,12 +512,78 @@ int draw_event_hook(void *hook_data, void *call_data) widget = control_flow_data->drawing->drawing_area; //draw_context_in->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; //draw_context_in->gc = widget->style->black_gc; - draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap); - gdk_gc_copy(draw_context_in->gc, widget->style->black_gc); + //draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap); + //gdk_gc_copy(draw_context_in->gc, widget->style->black_gc); //draw_arc((void*)&prop_arc, (void*)draw_context_in); //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap); + + /* Draw the line/bg of the in process */ + if(draw_context_in->previous->middle->x == -1) + { + draw_context_in->previous->middle->x = event_request->x_begin; + draw_context_in->previous->over->x = event_request->x_begin; + draw_context_in->previous->under->x = event_request->x_begin; + g_critical("in middle x_beg : %u",event_request->x_begin); + } + + draw_context_in->current->middle->x = x; + draw_context_in->current->over->x = x; + draw_context_in->current->under->x = x; + draw_context_in->current->middle->y = y_in + height/2; + draw_context_in->current->over->y = y_in; + draw_context_in->current->under->y = y_in + height; + draw_context_in->previous->middle->y = y_in + height/2; + draw_context_in->previous->over->y = y_in; + draw_context_in->previous->under->y = y_in + height; + draw_context_in->drawable = control_flow_data->drawing->pixmap; + draw_context_in->pango_layout = control_flow_data->drawing->pango_layout; + + + if(process_in->state->s == LTTV_STATE_RUN) + { + draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap); + gdk_gc_copy(draw_context_in->gc, widget->style->black_gc); + + PropertiesBG prop_bg; + prop_bg.color = g_new(GdkColor,1); + + switch(tfc->index) { + case 0: + prop_bg.color->red = 0x1515; + prop_bg.color->green = 0x1515; + prop_bg.color->blue = 0x8c8c; + break; + case 1: + prop_bg.color->red = 0x4e4e; + prop_bg.color->green = 0xa9a9; + prop_bg.color->blue = 0xa4a4; + break; + case 2: + prop_bg.color->red = 0x7a7a; + prop_bg.color->green = 0x4a4a; + prop_bg.color->blue = 0x8b8b; + break; + case 3: + prop_bg.color->red = 0x8080; + prop_bg.color->green = 0x7777; + prop_bg.color->blue = 0x4747; + break; + default: + prop_bg.color->red = 0xe7e7; + prop_bg.color->green = 0xe7e7; + prop_bg.color->blue = 0xe7e7; + } + + + draw_bg((void*)&prop_bg, (void*)draw_context_in); + g_free(prop_bg.color); + gdk_gc_unref(draw_context_in->gc); + } + + draw_context_in->gc = widget->style->black_gc; + GdkColor colorfg_in = { 0, 0x0000, 0xffff, 0x0000 }; GdkColor colorbg_in = { 0, 0x0000, 0x0000, 0x0000 }; PropertiesText prop_text_in; @@ -531,24 +656,11 @@ int draw_event_hook(void *hook_data, void *call_data) prop_text_in.text = "U"; draw_text((void*)&prop_text_in, (void*)draw_context_in); - gdk_gc_unref(draw_context_in->gc); - - /* Draw the line of the in process */ - if(draw_context_in->previous->middle->x == -1) - { - draw_context_in->previous->middle->x = event_request->x_begin; - g_critical("in middle x_beg : %u",event_request->x_begin); - } - - draw_context_in->current->middle->x = x; - draw_context_in->previous->middle->y = y_in + height/2; - draw_context_in->current->middle->y = y_in + height/2; - draw_context_in->drawable = control_flow_data->drawing->pixmap; - draw_context_in->pango_layout = control_flow_data->drawing->pango_layout; - //draw_context_in->gc = widget->style->black_gc; + //gdk_gc_unref(draw_context_in->gc); + draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap); gdk_gc_copy(draw_context_in->gc, widget->style->black_gc); - + PropertiesLine prop_line_in; prop_line_in.color = g_new(GdkColor,1); prop_line_in.line_width = 2; @@ -689,6 +801,7 @@ int draw_after_hook(void *hook_data, void *call_data) if(processlist_get_process_pixels(process_list, pid_out, &birth, + tfc->t_context->index, &y_out, &height, &hashed_process_data_out) == 1) @@ -697,12 +810,14 @@ int draw_after_hook(void *hook_data, void *call_data) processlist_add(process_list, pid_out, &birth, + tfc->t_context->index, name, &pl_height, &hashed_process_data_out); processlist_get_process_pixels(process_list, pid_out, &birth, + tfc->t_context->index, &y_out, &height, &hashed_process_data_out); @@ -722,6 +837,7 @@ int draw_after_hook(void *hook_data, void *call_data) if(processlist_get_process_pixels(process_list, pid_in, &birth, + tfc->t_context->index, &y_in, &height, &hashed_process_data_in) == 1) @@ -730,12 +846,14 @@ int draw_after_hook(void *hook_data, void *call_data) processlist_add(process_list, pid_in, &birth, + tfc->t_context->index, name, &pl_height, &hashed_process_data_in); processlist_get_process_pixels(process_list, pid_in, &birth, + tfc->t_context->index, &y_in, &height, &hashed_process_data_in); @@ -775,11 +893,28 @@ int draw_after_hook(void *hook_data, void *call_data) draw_context_out->pango_layout = control_flow_data->drawing->pango_layout; GtkWidget *widget = control_flow_data->drawing->drawing_area; //draw_context_out->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; - draw_context_out->gc = widget->style->black_gc; - + //draw_arc((void*)&prop_arc, (void*)draw_context_out); //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap); - + + /*if(process_out->state->s == LTTV_STATE_RUN) + { + draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap); + gdk_gc_copy(draw_context_out->gc, widget->style->black_gc); + PropertiesBG prop_bg; + prop_bg.color = g_new(GdkColor,1); + + prop_bg.color->red = 0xffff; + prop_bg.color->green = 0xffff; + prop_bg.color->blue = 0xffff; + + draw_bg((void*)&prop_bg, (void*)draw_context_out); + g_free(prop_bg.color); + gdk_gc_unref(draw_context_out->gc); + }*/ + + draw_context_out->gc = widget->style->black_gc; + GdkColor colorfg_out = { 0, 0xffff, 0x0000, 0x0000 }; GdkColor colorbg_out = { 0, 0x0000, 0x0000, 0x0000 }; PropertiesText prop_text_out; @@ -849,8 +984,12 @@ int draw_after_hook(void *hook_data, void *call_data) prop_text_out.text = "U"; draw_text((void*)&prop_text_out, (void*)draw_context_out); + + //gdk_gc_unref(draw_context_out->gc); draw_context_out->current->middle->y = y_out+height/2; + draw_context_out->current->over->y = y_out; + draw_context_out->current->under->y = y_out+height; draw_context_out->current->status = process_out->state->s; /* for pid_out : remove previous, Prev = current, new current (default) */ @@ -895,11 +1034,28 @@ int draw_after_hook(void *hook_data, void *call_data) draw_context_in->pango_layout = control_flow_data->drawing->pango_layout; widget = control_flow_data->drawing->drawing_area; //draw_context_in->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; - draw_context_in->gc = widget->style->black_gc; //draw_arc((void*)&prop_arc, (void*)draw_context_in); //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap); - + + /*if(process_in->state->s == LTTV_STATE_RUN) + { + draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap); + gdk_gc_copy(draw_context_in->gc, widget->style->black_gc); + PropertiesBG prop_bg; + prop_bg.color = g_new(GdkColor,1); + + prop_bg.color->red = 0xffff; + prop_bg.color->green = 0xffff; + prop_bg.color->blue = 0xffff; + + draw_bg((void*)&prop_bg, (void*)draw_context_in); + g_free(prop_bg.color); + gdk_gc_unref(draw_context_in->gc); + }*/ + + draw_context_in->gc = widget->style->black_gc; + GdkColor colorfg_in = { 0, 0x0000, 0xffff, 0x0000 }; GdkColor colorbg_in = { 0, 0x0000, 0x0000, 0x0000 }; PropertiesText prop_text_in; @@ -971,6 +1127,7 @@ int draw_after_hook(void *hook_data, void *call_data) draw_text((void*)&prop_text_in, (void*)draw_context_in); + if(process_in->state->s == LTTV_STATE_RUN) { gchar tmp[255]; @@ -993,6 +1150,8 @@ int draw_after_hook(void *hook_data, void *call_data) draw_context_in->current->middle->y = y_in+height/2; + draw_context_in->current->over->y = y_in; + draw_context_in->current->under->y = y_in+height; draw_context_in->current->status = process_in->state->s; /* for pid_in : remove previous, Prev = current, new current (default) */ @@ -1302,7 +1461,7 @@ gint update_current_time_hook(void *hook_data, void *call_data) typedef struct _ClosureData { EventRequest *event_request; - LttvTraceState *ts; + LttvTracesetState *tss; } ClosureData; @@ -1327,29 +1486,78 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data) &height); /* Get last state of process */ LttvTraceContext *tc = - (LttvTraceContext *)closure_data->ts; + ((LttvTracesetContext*)closure_data->tss)->traces[process_info->trace_num]; + //LttvTracefileContext *tfc = (LttvTracefileContext *)closure_data->ts; - LttvTraceState *ts = closure_data->ts; + LttvTraceState *ts = (LttvTraceState*)tc; LttvProcessState *process; - process = lttv_state_find_process((LttvTracefileState*)ts, process_info->pid); + process = lttv_state_find_process_from_trace(ts, process_info->pid); /* Draw the closing line */ DrawContext *draw_context = hashed_process_data->draw_context; if(draw_context->previous->middle->x == -1) { draw_context->previous->middle->x = closure_data->event_request->x_begin; + draw_context->previous->over->x = closure_data->event_request->x_begin; + draw_context->previous->under->x = closure_data->event_request->x_begin; g_critical("out middle x_beg : %u",closure_data->event_request->x_begin); } draw_context->current->middle->x = closure_data->event_request->x_end; + draw_context->current->over->x = closure_data->event_request->x_end; + draw_context->current->under->x = closure_data->event_request->x_end; draw_context->current->middle->y = y + height/2; + draw_context->current->over->y = y ; + draw_context->current->under->y = y + height; draw_context->previous->middle->y = y + height/2; + draw_context->previous->over->y = y ; + draw_context->previous->under->y = y + height; draw_context->drawable = control_flow_data->drawing->pixmap; draw_context->pango_layout = control_flow_data->drawing->pango_layout; //draw_context->gc = widget->style->black_gc; draw_context->gc = gdk_gc_new(control_flow_data->drawing->pixmap); gdk_gc_copy(draw_context->gc, widget->style->black_gc); + + if(process->state->s == LTTV_STATE_RUN) + { + PropertiesBG prop_bg; + prop_bg.color = g_new(GdkColor,1); + + /*switch(tfc->index) { + case 0: + prop_bg.color->red = 0x1515; + prop_bg.color->green = 0x1515; + prop_bg.color->blue = 0x8c8c; + break; + case 1: + prop_bg.color->red = 0x4e4e; + prop_bg.color->green = 0xa9a9; + prop_bg.color->blue = 0xa4a4; + break; + case 2: + prop_bg.color->red = 0x7a7a; + prop_bg.color->green = 0x4a4a; + prop_bg.color->blue = 0x8b8b; + break; + case 3: + prop_bg.color->red = 0x8080; + prop_bg.color->green = 0x7777; + prop_bg.color->blue = 0x4747; + break; + default: + prop_bg.color->red = 0xe7e7; + prop_bg.color->green = 0xe7e7; + prop_bg.color->blue = 0xe7e7; + } + */ + + g_critical("calling from closure"); + //FIXME : I need the cpu number in process's state to draw this. + //draw_bg((void*)&prop_bg, (void*)draw_context); + g_free(prop_bg.color); + } + PropertiesLine prop_line; prop_line.color = g_new(GdkColor,1); @@ -1455,7 +1663,7 @@ int after_data_request(void *hook_data, void *call_data) ClosureData closure_data; closure_data.event_request = (EventRequest*)hook_data; - closure_data.ts = (LttvTraceState*)call_data; + closure_data.tss = (LttvTracesetState*)call_data; g_hash_table_foreach(process_list->process_hash, draw_closure, (void*)&closure_data); diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c index 1d4333f8..4145f745 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c @@ -33,6 +33,7 @@ enum PID_COLUMN, BIRTH_S_COLUMN, BIRTH_NS_COLUMN, + TRACE_COLUMN, N_COLUMNS }; @@ -146,6 +147,37 @@ gint process_sort_func ( GtkTreeModel *model, g_value_unset(&a); g_value_unset(&b); + /* Order by trace_num */ + gtk_tree_model_get_value( model, + it_a, + TRACE_COLUMN, + &a); + + gtk_tree_model_get_value( model, + it_b, + TRACE_COLUMN, + &b); + + if(G_VALUE_TYPE(&a) == G_TYPE_ULONG + && G_VALUE_TYPE(&b) == G_TYPE_ULONG ) + { + if(g_value_get_ulong(&a) > g_value_get_ulong(&b)) + { + g_value_unset(&a); + g_value_unset(&b); + return 1; + } + if(g_value_get_ulong(&a) < g_value_get_ulong(&b)) + { + g_value_unset(&a); + g_value_unset(&b); + return 0; + } + + } + + + return 0; } @@ -168,6 +200,9 @@ gboolean equ_fct(gconstpointer a, gconstpointer b) return 0; // g_critical("compare %u and %u",((ProcessInfo*)a)->birth.tv_nsec,((ProcessInfo*)b)->birth.tv_nsec); + if(((ProcessInfo*)a)->trace_num != ((ProcessInfo*)b)->trace_num) + return 0; + return 1; } @@ -192,6 +227,7 @@ ProcessList *processlist_construct(void) G_TYPE_STRING, G_TYPE_UINT, G_TYPE_ULONG, + G_TYPE_ULONG, G_TYPE_ULONG); @@ -263,6 +299,15 @@ ProcessList *processlist_construct(void) gtk_tree_view_append_column ( GTK_TREE_VIEW (process_list->process_list_widget), column); + column = gtk_tree_view_column_new_with_attributes ( "TRACE", + renderer, + "text", + TRACE_COLUMN, + NULL); + gtk_tree_view_append_column ( + GTK_TREE_VIEW (process_list->process_list_widget), column); + + //gtk_tree_view_column_set_visible(column, 0); g_object_set_data_full( @@ -315,6 +360,7 @@ void destroy_hash_data(gpointer data) int processlist_add( ProcessList *process_list, guint pid, LttTime *birth, + guint trace_num, gchar *name, guint *height, HashedProcessData **pm_hashed_process_data) @@ -326,6 +372,7 @@ int processlist_add( ProcessList *process_list, Process_Info->pid = pid; Process_Info->birth = *birth; + Process_Info->trace_num = trace_num; hashed_process_data->draw_context = g_new(DrawContext, 1); hashed_process_data->draw_context->drawable = NULL; @@ -383,6 +430,7 @@ int processlist_add( ProcessList *process_list, PID_COLUMN, pid, BIRTH_S_COLUMN, birth->tv_sec, BIRTH_NS_COLUMN, birth->tv_nsec, + TRACE_COLUMN, trace_num, -1); hashed_process_data->row_ref = gtk_tree_row_reference_new ( GTK_TREE_MODEL(process_list->list_store), @@ -409,7 +457,8 @@ int processlist_add( ProcessList *process_list, int processlist_remove( ProcessList *process_list, guint pid, - LttTime *birth) + LttTime *birth, + guint trace_num) { ProcessInfo Process_Info; gint *path_indices; @@ -418,6 +467,7 @@ int processlist_remove( ProcessList *process_list, Process_Info.pid = pid; Process_Info.birth = *birth; + Process_Info.trace_num = trace_num; if(hashed_process_data = @@ -471,7 +521,7 @@ guint processlist_get_height(ProcessList *process_list) gint processlist_get_process_pixels( ProcessList *process_list, - guint pid, LttTime *birth, + guint pid, LttTime *birth, guint trace_num, guint *y, guint *height, HashedProcessData **pm_hashed_process_data) @@ -483,6 +533,7 @@ gint processlist_get_process_pixels( ProcessList *process_list, Process_Info.pid = pid; Process_Info.birth = *birth; + Process_Info.trace_num = trace_num; if(hashed_process_data = (HashedProcessData*)g_hash_table_lookup( diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.h b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.h index 75eda09a..20d39b9b 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.h +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.h @@ -45,6 +45,7 @@ typedef struct _ProcessInfo { guint pid; LttTime birth; + guint trace_num; } ProcessInfo; @@ -75,15 +76,17 @@ GtkWidget *processlist_get_widget(ProcessList *process_list); // out : success (0) and height int processlist_add(ProcessList *process_list, guint pid, LttTime *birth, - gchar *name, guint *height, HashedProcessData **hashed_process_data); + guint trace_num, gchar *name, guint *height, + HashedProcessData **hashed_process_data); // out : success (0) and height -int processlist_remove(ProcessList *process_list, guint pid, LttTime *birth); +int processlist_remove(ProcessList *process_list, guint pid, LttTime *birth, + guint trace_num); guint processlist_get_height(ProcessList *process_list); // Returns 0 on success gint processlist_get_process_pixels(ProcessList *process_list, - guint pid, LttTime *birth, + guint pid, LttTime *birth, guint trace_num, guint *y, guint *height, HashedProcessData **hashed_process_data); -- 2.34.1