ts->state_trace_handle_index = g_ptr_array_new();
ts->has_precomputed_states = FALSE;
+ ts->time_span.start_time = ltt_time_from_uint64(0);
+ ts->time_span.end_time = ltt_time_from_uint64(0);
+
return ts;
}
return lttv_traceset_position_get_timestamp(&begin_position);
}
+guint64 lttv_traceset_get_timestamp_last_event(LttvTraceset *ts)
+{
+ LttvTracesetPosition last_position;
+ struct bt_iter_pos pos;
+ last_position.bt_pos = &pos;
+ last_position.timestamp = G_MAXUINT64;
+ last_position.cpu_id = INT_MAX;
+
+ /* Assign iterator to the last event of the traces */
+ last_position.bt_pos->type = BT_SEEK_LAST;
+ last_position.iter = ts->iter;
+
+ return lttv_traceset_position_get_timestamp(&last_position);
+}
+
/*
* lttv_traceset_get_timestamp_begin : returns the minimum timestamp of
* all the traces in the traceset.
{
currentTrace = g_ptr_array_index(traceset->traces,i);
timestamp_cur = bt_trace_handle_get_timestamp_end(bt_ctx,
- currentTrace->id);
+ currentTrace->id);
if(timestamp_cur > timestamp_max){
timestamp_max = timestamp_cur;
}
}
/*
* lttv_traceset_get_time_span_real : return a TimeInterval representing the
- * minimum timestamp dans le maximum timestamp of the traceset.
+ * minimum timestamp and the maximum timestamp of the traceset.
*
*/
TimeInterval lttv_traceset_get_time_span_real(LttvTraceset *ts)
{
- TimeInterval time_span;
- time_span.start_time =ltt_time_from_uint64(lttv_traceset_get_timestamp_first_event(ts));
- time_span.end_time = ltt_time_from_uint64(lttv_traceset_get_timestamp_end(ts));
- return time_span;
+ if(ltt_time_compare(ts->time_span.start_time,
+ ltt_time_from_uint64(0)) == 0 && ts->traces->len > 0){
+ ts->time_span.start_time = ltt_time_from_uint64(
+ lttv_traceset_get_timestamp_first_event(ts));
+ ts->time_span.end_time = ltt_time_from_uint64(
+ lttv_traceset_get_timestamp_last_event(ts));
+ }
+ return ts->time_span;
}
/*
* lttv_traceset_get_time_span : return a TimeInterval representing the
- * minimum timestamp dans le maximum timestamp of the traceset.
+ * minimum timestamp and the maximum timestamp of the traceset.
*
*/
TimeInterval lttv_traceset_get_time_span(LttvTraceset *ts)
{
- TimeInterval time_span;
- time_span.start_time =ltt_time_from_uint64(lttv_traceset_get_timestamp_begin(ts));
- time_span.end_time = ltt_time_from_uint64(lttv_traceset_get_timestamp_end(ts));
- return time_span;
+ if(ltt_time_compare(ts->time_span.start_time, ltt_time_from_uint64(0)) == 0){
+ ts->time_span.start_time =ltt_time_from_uint64(
+ lttv_traceset_get_timestamp_begin(ts));
+ ts->time_span.end_time = ltt_time_from_uint64(
+ lttv_traceset_get_timestamp_end(ts));
+ }
+ return ts->time_span;
}
const char *lttv_traceset_get_name_from_event(LttvEvent *event)
struct bt_ctf_iter *iter;
GPtrArray *state_trace_handle_index;
gboolean has_precomputed_states;
+ TimeInterval time_span;
};
struct _LttvTrace {
lttv_hooks_add(event_hook,before_execmode_hook , control_flow_data, LTTV_PRIO_STATE-5);
#ifdef BABEL_CLEANUP
- lttv_hooks_add(event_hook,syscall_exit , control_flow_data, LTTV_PRIO_STATE);
- lttv_hooks_add(event_hook,irq_entry , control_flow_data, LTTV_PRIO_STATE);
- lttv_hooks_add(event_hook,irq_exit , control_flow_data, LTTV_PRIO_STATE);
- lttv_hooks_add(event_hook,soft_irq_raise , control_flow_data, LTTV_PRIO_STATE);
- lttv_hooks_add(event_hook,soft_irq_entry , control_flow_data, LTTV_PRIO_STATE);
- lttv_hooks_add(event_hook,soft_irq_exit , control_flow_data, LTTV_PRIO_STATE);
+ lttv_hooks_add(event_hook,syscall_exit , control_flow_data, LTTV_PRIO_STATE);
+ lttv_hooks_add(event_hook,irq_entry , control_flow_data, LTTV_PRIO_STATE);
+ lttv_hooks_add(event_hook,irq_exit , control_flow_data, LTTV_PRIO_STATE);
+ lttv_hooks_add(event_hook,soft_irq_raise , control_flow_data, LTTV_PRIO_STATE);
+ lttv_hooks_add(event_hook,soft_irq_entry , control_flow_data, LTTV_PRIO_STATE);
+ lttv_hooks_add(event_hook,soft_irq_exit , control_flow_data, LTTV_PRIO_STATE);
#endif //babel_cleanup
lttv_hooks_add(event_hook,before_schedchange_hook , control_flow_data, LTTV_PRIO_STATE-5);
#ifdef BABEL_CLEANUP
gint64 state_out;
LttTime timestamp;
event = (LttvEvent *) call_data;
- if (strcmp(lttv_traceset_get_name_from_event(event),
- "sched_switch") != 0)
- return FALSE;
+ if (strcmp(lttv_traceset_get_name_from_event(event),"sched_switch") != 0)
+ return FALSE;
+
ControlFlowData *control_flow_data = (ControlFlowData*)hook_data;
*/
cpu = lttv_traceset_get_cpuid_from_event(event);
ts = event->state;
- process = ts->running_process[cpu];
+
pid_out = lttv_event_get_long(event, "prev_tid");
pid_in = lttv_event_get_long(event, "next_tid");
state_out = lttv_event_get_long(event, "prev_state");
+ guint trace_number = 0;//TODO fdeslauriers 2012-07-17: // Use trace handle to know trace number
+ process = lttv_state_find_process(ts,cpu,pid_out);
timestamp = lttv_event_get_timestamp(event);
/* For the pid_out */
/* First, check if the current process is in the state computation
pid_out,
process->cpu,
&birth,
- 18);//TODO "use the right value or delete"
+ trace_number);
if(hashed_process_data == NULL)
{
g_assert(pid_out == 0 || pid_out != process->ppid);
process->cpu,
process->ppid,
&birth,
- 18,//TODO "use the right value or delete"
+ trace_number,
process->name,
process->brand,
&pl_height,
* 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. */
- process = ts->running_process[cpu];
+ process = lttv_state_find_process(ts,cpu,pid_in);
if(process != NULL) {
/* Well, the process existed : we must get it in the process hash
pid_in,
cpu,
&birth,
- 18);//TODO "use the right value or delete"
+ trace_number);//TODO "use the right value or delete"
if(hashed_process_data == NULL)
{
g_assert(pid_in == 0 || pid_in != process->ppid);
cpu,
process->ppid,
&birth,
- 18,
+ trace_number,
process->name,
process->brand,
&pl_height,
{
LttvEvent *event;
guint cpu;
+ guint pid;
LttvTraceState *ts;
LttvProcessState *process;
*/
event = (LttvEvent *) call_data;
- if (strcmp(lttv_traceset_get_name_from_event(event),
- "irq_handler_entry") != 0)
- return FALSE;
+ if ((strncmp(lttv_traceset_get_name_from_event(event),"sys_", sizeof("sys_") - 1) == 0)
+ ||(strcmp(lttv_traceset_get_name_from_event(event),"exit_syscall") == 0)
+ ||(strncmp(lttv_traceset_get_name_from_event(event),"irq_handler_",sizeof("irq_handler_")) == 0)
+ ||(strncmp(lttv_traceset_get_name_from_event(event),"softirq_", sizeof("softirq_")) == 0)){
+
LttTime evtime = lttv_event_get_timestamp(event);
ControlFlowData *control_flow_data = (ControlFlowData*)hook_data;
/* For the pid */
ts = event->state;
guint trace_number = 0;//TODO fdeslauriers 2012-07-17: // Use trace handle to know trace number
- process = ts->running_process[cpu];
+ process = lttv_state_find_process(ts ,cpu ,pid);
g_assert(process != NULL);
guint pid = process->pid;
&hashed_process_data->next_good_time);
}
}
-
+ }
return 0;
}
EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
LttvTraceset * ts = lttvwindow_get_traceset(event_viewer_data->tab);
- TimeInterval time_span = lttv_traceset_get_time_span(ts);
+ TimeInterval time_span = lttv_traceset_get_time_span_real(ts);
LttTime end;
EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
LttvTraceset * ts = lttvwindow_get_traceset(event_viewer_data->tab);
- TimeInterval time_span = lttv_traceset_get_time_span(ts);
+ TimeInterval time_span = lttv_traceset_get_time_span_real(ts);
LttTime end;
gtk_list_store_clear(event_viewer_data->store_m);
LttvTraceset *traceset =
lttvwindow_get_traceset(histocontrol_flow_data->tab);
- TimeInterval time_span = lttv_traceset_get_time_span(traceset);
+ TimeInterval time_span = lttv_traceset_get_time_span_real(traceset);
LttTime trace_start = time_span.start_time;
LttTime trace_end = time_span.end_time;
}
#endif /*BABEL_CLEANUP*/
- time_span = lttv_traceset_get_time_span(traceset);
+ time_span = lttv_traceset_get_time_span_real(traceset);
tab->traceset_info->traceset = traceset;
TimeInterval time_span;
LttvTraceset *ts = tab->traceset_info->traceset;
- time_span.start_time =ltt_time_from_uint64( lttv_traceset_get_timestamp_begin(ts));
- time_span.end_time = ltt_time_from_uint64(lttv_traceset_get_timestamp_end(ts));
+ time_span = lttv_traceset_get_time_span_real(ts);
LttTime start_time = new_time_window.start_time;
LttTime end_time = new_time_window.end_time;
{
Tab *tab = (Tab *)user_data;
LttvTraceset * ts =tab->traceset_info->traceset;
- TimeInterval time_span = lttv_traceset_get_time_span(ts);
+ TimeInterval time_span = lttv_traceset_get_time_span_real(ts);
TimeWindow new_time_window = tab->time_window;
new_time_window.start_time = timebar_get_start_time(timebar);
{
Tab *tab = (Tab *)user_data;
LttvTraceset * ts =tab->traceset_info->traceset;
- TimeInterval time_span = lttv_traceset_get_time_span(ts);
+ TimeInterval time_span = lttv_traceset_get_time_span_real(ts);
TimeWindow new_time_window = tab->time_window;
gdouble page_size;
LttvTraceset * ts = tab->traceset_info->traceset;
- TimeInterval time_span = lttv_traceset_get_time_span(ts);
+ TimeInterval time_span = lttv_traceset_get_time_span_real(ts);
time = ltt_time_add(ltt_time_from_double(value),
time_span.start_time);