From d41c66bf9a23a32605f5f30127cce2cbd68307a8 Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 6 Jul 2006 18:30:33 +0000 Subject: [PATCH] print trace name, some additions to state file save git-svn-id: http://ltt.polymtl.ca/svn@1978 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/print.c | 4 +++- ltt/branches/poly/lttv/lttv/state.c | 29 ++++++++++++++--------------- ltt/branches/poly/lttv/lttv/state.h | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/print.c b/ltt/branches/poly/lttv/lttv/print.c index ff9116a4..ef11b21c 100644 --- a/ltt/branches/poly/lttv/lttv/print.c +++ b/ltt/branches/poly/lttv/lttv/print.c @@ -243,10 +243,12 @@ void lttv_event_to_string(LttEvent *e, GString *s, if(mandatory_fields) { time = ltt_event_time(e); - g_string_append_printf(s,"%s.%s: %ld.%09ld (%s_%u)", + g_string_append_printf(s,"%s.%s: %ld.%09ld (%s%s_%u)", g_quark_to_string(ltt_facility_name(facility)), g_quark_to_string(ltt_eventtype_name(event_type)), (long)time.tv_sec, time.tv_nsec, + g_quark_to_string( + ltt_trace_name(ltt_tracefile_get_trace(tfs->parent.tf))), g_quark_to_string(ltt_tracefile_name(tfs->parent.tf)), cpu); /* Print the process id and the state/interrupt type of the process */ diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index 85a50e80..846c1ebd 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -424,7 +424,7 @@ static void write_process_state(gpointer key, gpointer value, process = (LttvProcessState *)value; fprintf(fp, -" \n", +" \n", process, process->pid, process->tgid, process->ppid, g_quark_to_string(process->type), process->creation_time.tv_sec, @@ -673,8 +673,6 @@ static void read_process_state_raw(LttvTraceState *self, FILE *fp) LttvProcessState *process, *parent_process; LttvProcessState tmp; - FILE *fp = (FILE *)user_data; - guint i; guint64 address; guint cpu; @@ -691,14 +689,13 @@ static void read_process_state_raw(LttvTraceState *self, FILE *fp) fread(&tmp.insertion_time, sizeof(tmp.insertion_time), 1, fp); if(tmp.pid == 0) { - process = lttv_state_find_process(self, tmp.cpu, tmp.pid, - tmp.insertion_time); + process = lttv_state_find_process(self, tmp.cpu, tmp.pid); } else { /* We must link to the parent */ parent_process = lttv_state_find_process_or_create(self, ANY_CPU, tmp.ppid, - LTT_TIME_ZERO); + <t_time_zero); process = lttv_state_find_process_or_create(self, ANY_CPU, tmp.pid, - tmp.insertion_time); + &tmp.insertion_time); } process->creation_time = tmp.creation_time; process->type = tmp.type; @@ -709,7 +706,7 @@ static void read_process_state_raw(LttvTraceState *self, FILE *fp) do { if(feof(fp) || ferror(fp)) goto end_loop; - hdr = fgetc(fp); + gint hdr = fgetc(fp); switch(hdr) { case HDR_ES: @@ -726,7 +723,7 @@ static void read_process_state_raw(LttvTraceState *self, FILE *fp) }; } while(1); end_loop: - + return; } @@ -737,6 +734,7 @@ void lttv_state_read_raw(LttvTraceState *self, FILE *fp) guint i, nb_tracefile, nb_block, offset; guint64 tsc; LttTracefile *tf; + LttvTracefileState *tfcs; LttEventPosition *ep; @@ -810,17 +808,18 @@ end_loop: fread(&tfcs->parent.timestamp, sizeof(tfcs->parent.timestamp), 1, fp); /* Note : if timestamp if LTT_TIME_INFINITE, there will be no * position following : end of trace */ - if(ltt_time_compare(tfcs->parent.timestamp, LTT_TIME_INFINITE) != 0) { + if(ltt_time_compare(tfcs->parent.timestamp, ltt_time_infinite) != 0) { fread(&nb_block, sizeof(nb_block), 1, fp); fread(&offset, sizeof(offset), 1, fp); fread(&tsc, sizeof(tsc), 1, fp); ltt_event_position_set(ep, tf, nb_block, offset, tsc); - g_assert(ltt_tracefile_seek_position(tfc->tf, ep) == 0); + gint ret = ltt_tracefile_seek_position(tfcs->parent.tf, ep); + g_assert(ret == 0); } } g_free(ep); - saved_states_tree = lttv_attribute_find_subdir(tcs->parent.t_a, + saved_states_tree = lttv_attribute_find_subdir(self->parent.t_a, LTTV_STATE_SAVED_STATES); saved_state_tree = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); value = lttv_attribute_add(saved_states_tree, @@ -828,9 +827,9 @@ end_loop: *(value.v_gobject) = (GObject *)saved_state_tree; value = lttv_attribute_add(saved_state_tree, LTTV_STATE_TIME, LTTV_TIME); *(value.v_time) = t; - lttv_state_save(tcs, saved_state_tree); + lttv_state_save(self, saved_state_tree); g_debug("Saving state at time %lu.%lu", t.tv_sec, - self->parent.timestamp.tv_nsec); + t.tv_nsec); *(self->max_time_state_recomputed_in_seek) = t; } @@ -1659,7 +1658,7 @@ LttvProcessState *lttv_state_find_process(LttvTraceState *ts, guint cpu, LttvProcessState * lttv_state_find_process_or_create(LttvTraceState *ts, guint cpu, guint pid, - LttTime *timestamp) + const LttTime *timestamp) { LttvProcessState *process = lttv_state_find_process(ts, cpu, pid); LttvExecutionState *es; diff --git a/ltt/branches/poly/lttv/lttv/state.h b/ltt/branches/poly/lttv/lttv/state.h index bed8c297..f0313848 100644 --- a/ltt/branches/poly/lttv/lttv/state.h +++ b/ltt/branches/poly/lttv/lttv/state.h @@ -238,7 +238,7 @@ lttv_state_find_process(LttvTraceState *ts, guint cpu, guint pid); LttvProcessState * lttv_state_find_process_or_create(LttvTraceState *ts, guint cpu, guint pid, - LttTime *timestamp); + const LttTime *timestamp); LttvProcessState * lttv_state_create_process(LttvTraceState *tcs, LttvProcessState *parent, -- 2.34.1