From ae3d0f50f89e7b965795a9b9ad7e1f533f760598 Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 9 Mar 2006 01:25:38 +0000 Subject: [PATCH] add usertrace support git-svn-id: http://ltt.polymtl.ca/svn@1623 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ltt/facility.c | 6 +- ltt/branches/poly/ltt/ltt-private.h | 3 + ltt/branches/poly/ltt/trace.h | 10 +- ltt/branches/poly/ltt/tracefile.c | 173 ++++++++++++++---- ltt/branches/poly/lttv/lttv/batchtest.c | 6 +- ltt/branches/poly/lttv/lttv/filter.c | 3 +- ltt/branches/poly/lttv/lttv/print.c | 2 +- ltt/branches/poly/lttv/lttv/state.c | 56 ++++-- ltt/branches/poly/lttv/lttv/state.h | 3 +- ltt/branches/poly/lttv/lttv/stats.c | 6 +- .../lttv/modules/gui/controlflow/eventhooks.c | 24 +-- .../lttv/modules/gui/detailedevents/events.c | 3 +- .../poly/lttv/modules/text/textDump.c | 2 +- 13 files changed, 220 insertions(+), 77 deletions(-) diff --git a/ltt/branches/poly/ltt/facility.c b/ltt/branches/poly/ltt/facility.c index 9a302d2a..0440efb4 100644 --- a/ltt/branches/poly/ltt/facility.c +++ b/ltt/branches/poly/ltt/facility.c @@ -281,7 +281,11 @@ void construct_fields(LttFacility *fac, type_descriptor_t *td; LttType *type; - field->name = g_quark_from_string(fld->name); + if(fld->name) + field->name = g_quark_from_string(fld->name); + else + fld->name = 0; + if(fld->description) { len = strlen(fld->description); field->description = g_new(gchar, len+1); diff --git a/ltt/branches/poly/ltt/ltt-private.h b/ltt/branches/poly/ltt/ltt-private.h index 98e5b342..eceadc43 100644 --- a/ltt/branches/poly/ltt/ltt-private.h +++ b/ltt/branches/poly/ltt/ltt-private.h @@ -347,6 +347,9 @@ struct _LttTracefile{ GQuark long_name; //tracefile complete filename GQuark name; //tracefile name guint cpu_num; //cpu number of the tracefile + guint tid; //Usertrace tid, else 0 + guint pgid; //Usertrace pgid, else 0 + guint64 creation; //Usertrace creation, else 0 LttTrace * trace; //trace containing the tracefile int fd; //file descriptor off_t file_size; //file size diff --git a/ltt/branches/poly/ltt/trace.h b/ltt/branches/poly/ltt/trace.h index cd6bf7b7..0b63c937 100644 --- a/ltt/branches/poly/ltt/trace.h +++ b/ltt/branches/poly/ltt/trace.h @@ -86,7 +86,13 @@ GQuark ltt_tracefile_long_name(const LttTracefile *tf); /* get the cpu number of the tracefile */ -guint ltt_tracefile_num(LttTracefile *tf); +guint ltt_tracefile_cpu(LttTracefile *tf); + +/* For usertrace */ +guint ltt_tracefile_tid(LttTracefile *tf); +guint ltt_tracefile_pgid(LttTracefile *tf); +guint64 ltt_tracefile_creation(LttTracefile *tf); + LttTrace *ltt_tracefile_get_trace(LttTracefile *tf); @@ -183,4 +189,6 @@ gint64 ltt_get_int(gboolean reverse_byte_order, gint size, void *data); guint64 ltt_get_uint(gboolean reverse_byte_order, gint size, void *data); +LttTime ltt_interpolate_time_from_tsc(LttTracefile *tf, guint64 tsc); + #endif // TRACE_H diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index a1e19a7f..00e34444 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -642,9 +642,12 @@ void get_absolute_pathname(const gchar *pathname, gchar * abs_pathname) * The left side is the name, the right side is the number. */ -int get_tracefile_name_number(const gchar *raw_name, +int get_tracefile_name_number(gchar *raw_name, GQuark *name, - guint *num) + guint *num, + guint *tid, + guint *pgid, + guint64 *creation) { guint raw_name_len = strlen(raw_name); gchar char_name[PATH_MAX]; @@ -652,27 +655,84 @@ int get_tracefile_name_number(const gchar *raw_name, int underscore_pos; long int cpu_num; gchar *endptr; + gchar *tmpptr; for(i=raw_name_len-1;i>=0;i--) { if(raw_name[i] == '_') break; } - if(i==0) /* Either not found or name length is 0 */ - return -1; - underscore_pos = i; + if(i==-1) { /* Either not found or name length is 0 */ + /* This is a userspace tracefile */ + strncpy(char_name, raw_name, raw_name_len); + *name = g_quark_from_string(char_name); + *num = 0; /* unknown cpu */ + for(i=0;itracefiles, name); if(group == NULL) { @@ -1427,11 +1492,25 @@ GQuark ltt_tracefile_long_name(const LttTracefile *tf) -guint ltt_tracefile_num(LttTracefile *tf) +guint ltt_tracefile_cpu(LttTracefile *tf) { return tf->cpu_num; } +guint ltt_tracefile_tid(LttTracefile *tf) +{ + return tf->tid; +} + +guint ltt_tracefile_pgid(LttTracefile *tf) +{ + return tf->pgid; +} + +guint64 ltt_tracefile_creation(LttTracefile *tf) +{ + return tf->creation; +} /***************************************************************************** * Get the number of blocks in the tracefile ****************************************************************************/ @@ -1599,23 +1678,32 @@ fail: return 1; } -/* Calculate the real event time based on the buffer boundaries */ -LttTime ltt_interpolate_time(LttTracefile *tf, LttEvent *event) +LttTime ltt_interpolate_time_from_tsc(LttTracefile *tf, guint64 tsc) { LttTime time; - -// time = ltt_time_from_uint64( -// cycles_2_ns(tf, (guint64)(tf->buffer.tsc - tf->buffer.begin.cycle_count))); - time = ltt_time_from_uint64( - (double)(tf->buffer.tsc - tf->trace->start_tsc) - * (1000000000.0 / tf->trace->freq_scale) - / (double)tf->trace->start_freq); - //time = ltt_time_add(tf->buffer.begin.timestamp, time); - time = ltt_time_add(tf->trace->start_time_from_tsc, time); - + + if(tsc > tf->trace->start_tsc) { + time = ltt_time_from_uint64( + (double)(tsc - tf->trace->start_tsc) + * (1000000000.0 / tf->trace->freq_scale) + / (double)tf->trace->start_freq); + time = ltt_time_add(tf->trace->start_time_from_tsc, time); + } else { + time = ltt_time_from_uint64( + (double)(tf->trace->start_tsc - tsc) + * (1000000000.0 / tf->trace->freq_scale) + / (double)tf->trace->start_freq); + time = ltt_time_sub(tf->trace->start_time_from_tsc, time); + } return time; } +/* Calculate the real event time based on the buffer boundaries */ +LttTime ltt_interpolate_time(LttTracefile *tf, LttEvent *event) +{ + return ltt_interpolate_time_from_tsc(tf, tf->buffer.tsc); +} + /* Get the current event of the tracefile : valid until the next read */ LttEvent *ltt_tracefile_get_event(LttTracefile *tf) @@ -1830,12 +1918,19 @@ static gint map_block(LttTracefile * tf, guint block_num) &header->begin.cycle_count); tf->buffer.begin.freq = ltt_get_uint64(LTT_GET_BO(tf), &header->begin.freq); - tf->buffer.begin.timestamp = ltt_time_add( + if(tf->buffer.begin.freq == 0) + tf->buffer.begin.freq = tf->trace->start_freq; + + tf->buffer.begin.timestamp = ltt_interpolate_time_from_tsc(tf, + tf->buffer.begin.cycle_count); +#if 0 + ltt_time_add( ltt_time_from_uint64( (double)(tf->buffer.begin.cycle_count - tf->trace->start_tsc) * 1000000.0 / (double)tf->trace->start_freq), - tf->trace->start_time_from_tsc); + tf->trace->start_time_from_tsc); +#endif //0 #if 0 tf->buffer.end.timestamp = ltt_time_add( @@ -1851,15 +1946,21 @@ static gint map_block(LttTracefile * tf, guint block_num) &header->end.cycle_count); tf->buffer.end.freq = ltt_get_uint64(LTT_GET_BO(tf), &header->end.freq); + if(tf->buffer.end.freq == 0) + tf->buffer.end.freq = tf->trace->start_freq; + tf->buffer.lost_size = ltt_get_uint32(LTT_GET_BO(tf), &header->lost_size); - tf->buffer.end.timestamp = ltt_time_add( + tf->buffer.end.timestamp = ltt_interpolate_time_from_tsc(tf, + tf->buffer.end.cycle_count); +#if 0 + ltt_time_add( ltt_time_from_uint64( (double)(tf->buffer.end.cycle_count - tf->trace->start_tsc) * 1000000.0 / (double)tf->trace->start_freq), tf->trace->start_time_from_tsc); - +#endif //0 tf->buffer.tsc = tf->buffer.begin.cycle_count; tf->event.tsc = tf->buffer.tsc; tf->buffer.freq = tf->buffer.begin.freq; diff --git a/ltt/branches/poly/lttv/lttv/batchtest.c b/ltt/branches/poly/lttv/lttv/batchtest.c index 1a48d6a1..b38a1469 100644 --- a/ltt/branches/poly/lttv/lttv/batchtest.c +++ b/ltt/branches/poly/lttv/lttv/batchtest.c @@ -202,7 +202,7 @@ gboolean count_event(void *hook_data, void __UNUSED__ *call_data) g_warning("Time decreasing trace %s tracefile %s cpu %u position %u/0x%x", g_quark_to_string(ltt_trace_name(ltt_tracefile_get_trace(tracefile))), g_quark_to_string(ltt_tracefile_name(tracefile)), - ltt_tracefile_num(tracefile), nb_block, offset); + tfs->cpu, nb_block, offset); g_warning("last time %lu.%lu vs current %lu.%lu", count_previous_time.tv_sec, count_previous_time.tv_nsec, time.tv_sec, time.tv_nsec); @@ -316,7 +316,7 @@ static void compute_tracefile(LttTracefile *tracefile, void *hook_data) g_warning("test %s test", g_quark_to_string(ltt_tracefile_name(tracefile))); g_string_printf(filename, "%s.%s.%u.trace", a_dump_tracefiles, - mod_name, ltt_tracefile_num(tracefile)); + mod_name, ltt_tracefile_cpu(tracefile)); fp = fopen(filename->str, "w"); if(fp == NULL) g_error("Cannot open %s", filename->str); g_string_free(filename, TRUE); @@ -346,7 +346,7 @@ static void compute_tracefile(LttTracefile *tracefile, void *hook_data) g_warning("Time decreasing trace %s tracefile %s cpu %u position %u/0x%x", g_quark_to_string(ltt_trace_name(ltt_tracefile_get_trace(tracefile))), g_quark_to_string(ltt_tracefile_name(tracefile)), - ltt_tracefile_num(tracefile), nb_block, offset); + ltt_tracefile_cpu(tracefile), nb_block, offset); g_warning("last time %lu.%lu vs current %lu.%lu", previous_time.tv_sec, previous_time.tv_nsec, time.tv_sec, time.tv_nsec); diff --git a/ltt/branches/poly/lttv/lttv/filter.c b/ltt/branches/poly/lttv/lttv/filter.c index abdeb464..567b54f0 100644 --- a/ltt/branches/poly/lttv/lttv/filter.c +++ b/ltt/branches/poly/lttv/lttv/filter.c @@ -1815,8 +1815,9 @@ lttv_filter_tree_parse( LttvProcessState* state; - guint cpu = ltt_tracefile_num(context->tf); LttvTraceState *ts = (LttvTraceState*)context->t_context; + LttvTracefileState *tfs = (LttvTracefileState*)context; + guint cpu = tfs->cpu; state = ts->running_process[cpu]; /* diff --git a/ltt/branches/poly/lttv/lttv/print.c b/ltt/branches/poly/lttv/lttv/print.c index 50c7c674..a6fcd2d1 100644 --- a/ltt/branches/poly/lttv/lttv/print.c +++ b/ltt/branches/poly/lttv/lttv/print.c @@ -161,7 +161,7 @@ void lttv_event_to_string(LttEvent *e, GString *s, LttTime time; - guint cpu = ltt_tracefile_num(tfs->parent.tf); + guint cpu = tfs->cpu; LttvTraceState *ts = (LttvTraceState*)tfs->parent.t_context; LttvProcessState *process = ts->running_process[cpu]; diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index 6c7fb339..5eb533fa 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -259,18 +259,30 @@ init(LttvTracesetState *self, LttvTraceset *ts) get_max_time(tcs); nb_tracefile = tc->tracefiles->len; -#if 0 + tcs->processes = NULL; + tcs->running_process = g_new(LttvProcessState*, + ltt_trace_get_num_cpu(tc->t)); + restore_init_state(tcs); for(j = 0 ; j < nb_tracefile ; j++) { tfcs = LTTV_TRACEFILE_STATE(g_array_index(tc->tracefiles, LttvTracefileContext*, j)); tfcs->tracefile_name = ltt_tracefile_name(tfcs->parent.tf); + tfcs->cpu = ltt_tracefile_cpu(tfcs->parent.tf); + + if(ltt_tracefile_tid(tfcs->parent.tf) != 0) { + /* It's a Usertrace */ + LttvProcessState *process; + LttTime timestamp = + ltt_interpolate_time_from_tsc(tfcs->parent.tf, + ltt_tracefile_creation(tfcs->parent.tf)); + process = lttv_state_find_process_or_create( + tcs, + 0, ltt_tracefile_tid(tfcs->parent.tf), + ×tamp); + process->usertrace = tfcs; + } } -#endif //0 - tcs->processes = NULL; - tcs->running_process = g_new(LttvProcessState*, - ltt_trace_get_num_cpu(tc->t)); - restore_init_state(tcs); } } @@ -940,8 +952,8 @@ static void push_state(LttvTracefileState *tfs, LttvExecutionMode t, { LttvExecutionState *es; - guint cpu = ltt_tracefile_num(tfs->parent.tf); LttvTraceState *ts = (LttvTraceState*)tfs->parent.t_context; + guint cpu = tfs->cpu; #ifdef HASH_TABLE_DEBUG hash_table_check(ts->processes); @@ -967,7 +979,7 @@ static void push_state(LttvTracefileState *tfs, LttvExecutionMode t, static void pop_state(LttvTracefileState *tfs, LttvExecutionMode t) { - guint cpu = ltt_tracefile_num(tfs->parent.tf); + guint cpu = tfs->cpu; LttvTraceState *ts = (LttvTraceState*)tfs->parent.t_context; LttvProcessState *process = ts->running_process[cpu]; @@ -1019,6 +1031,7 @@ lttv_state_create_process(LttvTraceState *tcs, LttvProcessState *parent, //process->last_cpu = tfs->cpu_name; //process->last_cpu_index = ltt_tracefile_num(((LttvTracefileContext*)tfs)->tf); process->kernel_thread = 0; + process->usertrace = NULL; g_info("Process %u, core %p", process->pid, process); g_hash_table_insert(tcs->processes, process, process); @@ -1249,7 +1262,7 @@ static gboolean soft_irq_exit(void *hook_data, void *call_data) static gboolean schedchange(void *hook_data, void *call_data) { LttvTracefileState *s = (LttvTracefileState *)call_data; - guint cpu = ltt_tracefile_num(s->parent.tf); + guint cpu = s->cpu; LttvTraceState *ts = (LttvTraceState*)s->parent.t_context; LttvProcessState *process = ts->running_process[cpu]; LttvProcessState *old_process = ts->running_process[cpu]; @@ -1298,6 +1311,8 @@ static gboolean schedchange(void *hook_data, void *call_data) &s->parent.timestamp); process->state->s = LTTV_STATE_RUN; process->cpu = cpu; + if(process->usertrace) + process->usertrace->cpu = cpu; // process->last_cpu_index = ltt_tracefile_num(((LttvTracefileContext*)s)->tf); process->state->change = s->parent.timestamp; return FALSE; @@ -1311,7 +1326,7 @@ static gboolean process_fork(void *hook_data, void *call_data) guint parent_pid; guint child_pid; LttvProcessState *zombie_process; - guint cpu = ltt_tracefile_num(s->parent.tf); + guint cpu = s->cpu; LttvTraceState *ts = (LttvTraceState*)s->parent.t_context; LttvProcessState *process = ts->running_process[cpu]; LttvProcessState *child_process; @@ -1357,8 +1372,10 @@ static gboolean process_fork(void *hook_data, void *call_data) * * Simply put a correct parent. */ - g_assert(0); /* This is a problematic case : the process has been created - before the fork event */ + //It can also happen when created by a usertrace. In that case, it's + //correct. + //g_assert(0); /* This is a problematic case : the process has been created + // before the fork event */ child_process->ppid = process->pid; } g_assert(child_process->name == LTTV_STATE_UNNAMED); @@ -1374,7 +1391,7 @@ static gboolean process_kernel_thread(void *hook_data, void *call_data) LttEvent *e = ltt_tracefile_get_event(s->parent.tf); LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; guint pid; - guint cpu = ltt_tracefile_num(s->parent.tf); + guint cpu = s->cpu; LttvTraceState *ts = (LttvTraceState*)s->parent.t_context; LttvProcessState *process; LttvExecutionState *es; @@ -1397,7 +1414,7 @@ static gboolean process_exit(void *hook_data, void *call_data) LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; LttField *f; guint pid; - guint cpu = ltt_tracefile_num(s->parent.tf); + guint cpu = s->cpu; LttvTraceState *ts = (LttvTraceState*)s->parent.t_context; LttvProcessState *process = ts->running_process[cpu]; @@ -1466,7 +1483,7 @@ static gboolean process_exec(void *hook_data, void *call_data) LttEvent *e = ltt_tracefile_get_event(s->parent.tf); LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; //gchar *name; - guint cpu = ltt_tracefile_num(s->parent.tf); + guint cpu = s->cpu; LttvProcessState *process = ts->running_process[cpu]; /* PID of the process to release */ @@ -1495,7 +1512,7 @@ static gboolean enum_process_state(void *hook_data, void *call_data) guint parent_pid; guint pid; gchar * command; - guint cpu = ltt_tracefile_num(s->parent.tf); + guint cpu = s->cpu; LttvTraceState *ts = (LttvTraceState*)s->parent.t_context; LttvProcessState *process = ts->running_process[cpu]; LttvProcessState *parent_process; @@ -1843,6 +1860,13 @@ static gboolean state_save_after_trace_hook(void *hook_data, void *call_data) return FALSE; } +guint lttv_state_current_cpu(LttvTracefileState *tfs) +{ + return tfs->cpu; +} + + + #if 0 static gboolean block_start(void *hook_data, void *call_data) { diff --git a/ltt/branches/poly/lttv/lttv/state.h b/ltt/branches/poly/lttv/lttv/state.h index c1095d80..3ddc018e 100644 --- a/ltt/branches/poly/lttv/lttv/state.h +++ b/ltt/branches/poly/lttv/lttv/state.h @@ -190,7 +190,6 @@ typedef struct _LttvExecutionState { LttvProcessStatus s; } LttvExecutionState; - typedef struct _LttvProcessState { guint pid; guint ppid; @@ -207,6 +206,7 @@ typedef struct _LttvProcessState { the active or inactive runqueue)*/ gboolean kernel_thread; /* Is this thread a kernel_thread ? */ // guint last_tracefile_index; /* index in the trace for cpu tracefile */ + LttvTracefileState *usertrace; /* Associated usertrace */ /* opened file descriptors, address map?... */ } LttvProcessState; @@ -303,6 +303,7 @@ struct _LttvTracefileState { //LttvProcessState *process; GQuark tracefile_name; + guint cpu; /* Current cpu of the tracefile */ // guint saved_position; }; diff --git a/ltt/branches/poly/lttv/lttv/stats.c b/ltt/branches/poly/lttv/lttv/stats.c index 143c14e2..f7ba2ff0 100644 --- a/ltt/branches/poly/lttv/lttv/stats.c +++ b/ltt/branches/poly/lttv/lttv/stats.c @@ -417,7 +417,7 @@ find_event_tree(LttvTracefileStats *tfcs, static void update_event_tree(LttvTracefileStats *tfcs) { LttvTraceState *ts = (LttvTraceState *)tfcs->parent.parent.t_context; - guint cpu = ltt_tracefile_num(tfcs->parent.parent.tf); + guint cpu = tfcs->parent.cpu; LttvProcessState *process = ts->running_process[cpu]; LttvExecutionState *es = process->state; @@ -431,7 +431,7 @@ static void update_event_tree(LttvTracefileStats *tfcs) static void mode_change(LttvTracefileStats *tfcs) { LttvTraceState *ts = (LttvTraceState *)tfcs->parent.parent.t_context; - guint cpu = ltt_tracefile_num(tfcs->parent.parent.tf); + guint cpu = tfcs->parent.cpu; LttvProcessState *process = ts->running_process[cpu]; LttvAttributeValue cpu_time; @@ -448,7 +448,7 @@ static void mode_change(LttvTracefileStats *tfcs) static void mode_end(LttvTracefileStats *tfcs) { LttvTraceState *ts = (LttvTraceState *)tfcs->parent.parent.t_context; - guint cpu = ltt_tracefile_num(tfcs->parent.parent.tf); + guint cpu = tfcs->parent.cpu; LttvProcessState *process = ts->running_process[cpu]; LttvAttributeValue elapsed_time, cpu_time; diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index c79b0a4b..15739dd5 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -363,12 +363,12 @@ int before_schedchange_hook(void *hook_data, void *call_data) * draw items from the beginning of the read for it. If it is not * present, it's a new process and it was not present : it will * be added after the state update. */ - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; LttvProcessState *process = ts->running_process[cpu]; /* unknown state, bad current pid */ if(process->pid != pid_out) process = lttv_state_find_process(ts, - ltt_tracefile_num(tfc->tf), pid_out); + tfs->cpu, pid_out); if(process != NULL) { /* Well, the process_out existed : we must get it in the process hash @@ -524,7 +524,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) * be added after the state update. */ LttvProcessState *process; process = lttv_state_find_process(ts, - ltt_tracefile_num(tfc->tf), pid_in); + tfs->cpu, pid_in); if(process != NULL) { /* Well, the process existed : we must get it in the process hash @@ -538,7 +538,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) hashed_process_data = processlist_get_process_data(process_list, pid_in, - ltt_tracefile_num(tfc->tf), + tfs->cpu, &birth, tfc->t_context->index); if(hashed_process_data == NULL) @@ -550,7 +550,7 @@ int before_schedchange_hook(void *hook_data, void *call_data) processlist_add(process_list, drawing, pid_in, - ltt_tracefile_num(tfc->tf), + tfs->cpu, process->ppid, &birth, tfc->t_context->index, @@ -748,7 +748,7 @@ int after_schedchange_hook(void *hook_data, void *call_data) /* Find process pid_in in the list... */ //process_in = lttv_state_find_process(ts, ANY_CPU, pid_in); //process_in = tfs->process; - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; process_in = ts->running_process[cpu]; /* It should exist, because we are after the state update. */ #ifdef EXTRA_CHECK @@ -861,7 +861,7 @@ int before_execmode_hook(void *hook_data, void *call_data) */ /* For the pid */ //LttvProcessState *process = tfs->process; - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; LttvProcessState *process = ts->running_process[cpu]; g_assert(process != NULL); @@ -1052,7 +1052,7 @@ int before_process_exit_hook(void *hook_data, void *call_data) /* Add process to process list (if not present) */ //LttvProcessState *process = tfs->process; - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; LttvProcessState *process = ts->running_process[cpu]; guint pid = process->pid; LttTime birth; @@ -1554,7 +1554,7 @@ int after_process_exit_hook(void *hook_data, void *call_data) /* Add process to process list (if not present) */ //LttvProcessState *process = tfs->process; - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; LttvProcessState *process = ts->running_process[cpu]; /* It should exist, because we are after the state update. */ @@ -1648,7 +1648,7 @@ int after_fs_exec_hook(void *hook_data, void *call_data) LttvTraceState *ts = (LttvTraceState *)tfc->t_context; - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; LttvProcessState *process = ts->running_process[cpu]; g_assert(process != NULL); @@ -1749,7 +1749,7 @@ int after_event_enum_process_hook(void *hook_data, void *call_data) /* Find process pid_in in the list... */ process_in = lttv_state_find_process(ts, ANY_CPU, pid_in); //process_in = tfs->process; - //guint cpu = ltt_tracefile_num(tfc->tf); + //guint cpu = tfs->cpu; //process_in = ts->running_process[cpu]; /* It should exist, because we are after the state update. */ #ifdef EXTRA_CHECK @@ -2228,7 +2228,7 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data) for(i=0;itracefiles->len;i++) { tfc = g_array_index(tc->tracefiles, LttvTracefileContext*, i); if(ltt_tracefile_name(tfc->tf) == LTT_NAME_CPU - && ltt_tracefile_num(tfc->tf) == process_info->cpu) + && tfs->cpu == process_info->cpu) break; } diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c index 705697c6..63a1bbf8 100644 --- a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c +++ b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c @@ -1481,6 +1481,7 @@ int event_hook(void *hook_data, void *call_data) { EventViewerData *event_viewer_data = (EventViewerData*)hook_data; LttvTracefileContext *tfc = (LttvTracefileContext*)call_data; + LttvTracefileState *tfs = (LttvTracefileState*)call_data; LttEvent *e = ltt_tracefile_get_event(tfc->tf); LttvFilter *filter = event_viewer_data->main_win_filter; @@ -1493,7 +1494,7 @@ int event_hook(void *hook_data, void *call_data) LttEventType *event_type = ltt_event_eventtype(e); LttTime time = ltt_event_time(e); - guint cpu = ltt_tracefile_num(tfc->tf); + guint cpu = tfs->cpu; LttvTraceState *ts = (LttvTraceState*)tfc->t_context; LttvProcessState *process = ts->running_process[cpu]; diff --git a/ltt/branches/poly/lttv/modules/text/textDump.c b/ltt/branches/poly/lttv/modules/text/textDump.c index dbb8ec0f..a823d948 100644 --- a/ltt/branches/poly/lttv/modules/text/textDump.c +++ b/ltt/branches/poly/lttv/modules/text/textDump.c @@ -236,7 +236,7 @@ static int write_event_content(void *hook_data, void *call_data) LttvFilter *filter; - guint cpu = ltt_tracefile_num(tfs->parent.tf); + guint cpu = tfs->cpu; LttvTraceState *ts = (LttvTraceState*)tfc->t_context; LttvProcessState *process = ts->running_process[cpu]; -- 2.34.1