From ad2e83bad527de248066d453c3c8717a970f3cc7 Mon Sep 17 00:00:00 2001 From: compudj Date: Wed, 4 Feb 2004 16:21:25 +0000 Subject: [PATCH] multiple traces/tracefiles change git-svn-id: http://ltt.polymtl.ca/svn@481 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/main/state.c | 58 +------------ .../lttv/modules/gui/controlflow/eventhooks.c | 86 +++++++++++-------- 2 files changed, 52 insertions(+), 92 deletions(-) diff --git a/ltt/branches/poly/lttv/main/state.c b/ltt/branches/poly/lttv/main/state.c index 2fb45279..0fa74a1c 100644 --- a/ltt/branches/poly/lttv/main/state.c +++ b/ltt/branches/poly/lttv/main/state.c @@ -61,9 +61,6 @@ 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); @@ -588,55 +585,6 @@ 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) { @@ -652,8 +600,10 @@ LttvProcessState *lttv_state_find_process_from_trace(LttvTraceState *ts, { LttvProcessState *process = g_hash_table_lookup(ts->processes, GUINT_TO_POINTER(pid)); - - if(process == NULL) process = create_process_from_trace(ts, NULL, pid); + //We do not create a process at this level, because we can be called + //from outside of state.c, and therefore cannot assume a tracefile + //exists. + //if(process == NULL) process = create_process_from_trace(ts, NULL, pid); return process; } diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index 8a5c6b9a..c4160db7 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -1519,7 +1519,7 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data) 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) + if(process != NULL && process->state->s == LTTV_STATE_RUN) { PropertiesBG prop_bg; prop_bg.color = g_new(GdkColor,1); @@ -1566,47 +1566,57 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data) prop_line.position = MIDDLE; /* color of line : status of the process */ - if(process->state->s == LTTV_STATE_UNNAMED) + if(process != NULL) { - 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; + 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; + } + } else { - prop_line.color->red = 0xffff; - prop_line.color->green = 0xffff; - prop_line.color->blue = 0xffff; + prop_line.color->red = 0xffff; + prop_line.color->green = 0xffff; + prop_line.color->blue = 0xffff; } draw_line((void*)&prop_line, (void*)draw_context); -- 2.34.1