X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Fstate.c;h=d60b4588a3d3f428ac39c8d3951e5129d598710b;hb=bc8d270bb296f985deb9e37e29e41d445daaac28;hp=2ff087f48d335aef3363dcd593445f0bf7bbe598;hpb=7893f726b92c58d32505219ea5275d138c3ee3ff;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index 2ff087f4..d60b4588 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -26,6 +26,8 @@ #include #include +#define PREALLOCATED_EXECUTION_STACK 10 + LttvExecutionMode LTTV_STATE_MODE_UNKNOWN, LTTV_STATE_USER_MODE, @@ -137,6 +139,7 @@ restore_init_state(LttvTraceState *self) tfcs->process = lttv_state_create_process(tfcs, NULL,0); tfcs->process->state->s = LTTV_STATE_RUN; tfcs->process->last_cpu = tfcs->cpu_name; + tfcs->process->last_cpu_index = ((LttvTracefileContext*)tfcs)->index; } } @@ -322,8 +325,8 @@ static void copy_process_state(gpointer key, gpointer value,gpointer user_data) process = (LttvProcessState *)value; new_process = g_new(LttvProcessState, 1); *new_process = *process; - new_process->execution_stack = g_array_new(FALSE, FALSE, - sizeof(LttvExecutionState)); + new_process->execution_stack = g_array_sized_new(FALSE, FALSE, + sizeof(LttvExecutionState), PREALLOCATED_EXECUTION_STACK); g_array_set_size(new_process->execution_stack,process->execution_stack->len); for(i = 0 ; i < process->execution_stack->len; i++) { g_array_index(new_process->execution_stack, LttvExecutionState, i) = @@ -777,6 +780,7 @@ lttv_state_create_process(LttvTracefileState *tfs, LttvProcessState *parent, process->pid = pid; process->last_cpu = tfs->cpu_name; + process->last_cpu_index = ((LttvTracefileContext*)tfs)->index; g_warning("Process %u, core %p", process->pid, process); g_hash_table_insert(tcs->processes, process, process); @@ -801,8 +805,9 @@ lttv_state_create_process(LttvTracefileState *tfs, LttvProcessState *parent, process->creation_time.tv_nsec); process->pid_time = g_quark_from_string(buffer); process->last_cpu = tfs->cpu_name; - process->execution_stack = g_array_new(FALSE, FALSE, - sizeof(LttvExecutionState)); + process->last_cpu_index = ((LttvTracefileContext*)tfs)->index; + process->execution_stack = g_array_sized_new(FALSE, FALSE, + sizeof(LttvExecutionState), PREALLOCATED_EXECUTION_STACK); g_array_set_size(process->execution_stack, 1); es = process->state = &g_array_index(process->execution_stack, LttvExecutionState, 0); @@ -989,6 +994,7 @@ static gboolean schedchange(void *hook_data, void *call_data) s->process = lttv_state_find_process_or_create(s, pid_in); s->process->state->s = LTTV_STATE_RUN; s->process->last_cpu = s->cpu_name; + s->process->last_cpu_index = ((LttvTracefileContext*)s)->index; s->process->state->change = s->parent.timestamp; return FALSE; }