#include <stdio.h>
#include <string.h>
#include <inttypes.h>
+#include <babeltrace/babeltrace.h>
#define PREALLOCATED_EXECUTION_STACK 10
start_time = ltt_time_from_uint64(
bt_trace_handle_get_timestamp_begin(self->trace->traceset->context,
- self->trace->id));
+ self->trace->id,BT_CLOCK_REAL));
//lttv_process_trace_seek_time(&self->parent, ltt_time_zero);
process->execution_stack =
g_array_set_size(process->execution_stack, depth - 1);
+
process->state = &g_array_index(process->execution_stack, LttvExecutionState,
depth - 2);
process->state->change = lttv_event_get_timestamp(event);
+
+ if((process->state->t == LTTV_STATE_MODE_UNKNOWN) && (t == LTTV_STATE_SYSCALL)) {
+ //Force state at running
+ process->state->t = LTTV_STATE_USER_MODE;
+ process->state->s = LTTV_STATE_RUN;
+ }
}
struct search_result {
/* Skip Parent PID param */
/* Child PID */
- child_pid = lttv_event_get_long_unsigned(event, "child_tid");
+ child_pid = lttv_event_get_long(event, "child_tid");
//ts->target_pid = child_pid;
/* Child TGID */
lttv_hooks_add(event_hook,schedchange , NULL, LTTV_PRIO_STATE);
lttv_hooks_add(event_hook,sched_try_wakeup , NULL, LTTV_PRIO_STATE);
lttv_hooks_add(event_hook,process_exit , NULL, LTTV_PRIO_STATE);
- lttv_hooks_add(event_hook,process_free , NULL, LTTV_PRIO_STATE);
+ lttv_hooks_add(event_hook,process_free , NULL, LTTV_PRIO_STATE);
+ lttv_hooks_add(event_hook,process_fork , NULL, LTTV_PRIO_STATE);
lttv_hooks_add(event_hook,process_exec , NULL, LTTV_PRIO_STATE);
lttv_hooks_add(event_hook,enum_process_state , NULL, LTTV_PRIO_STATE);
lttv_hooks_add(event_hook,statedump_end , NULL, LTTV_PRIO_STATE);
LttvAttribute *saved_states_tree, *saved_state_tree, *closest_tree = NULL;
LttTime closest_tree_time, restored_time;
+ guint first_restored_time = 1;
//g_tree_destroy(self->parent.pqueue);
//self->parent.pqueue = g_tree_new(compare_tracefile);
- g_info("Entering seek_time_closest for time %lu.%lu", t.tv_sec, t.tv_nsec);
+ g_debug("Entering seek_time_closest for time %lu.%lu", t.tv_sec, t.tv_nsec);
nb_trace = lttv_traceset_number(traceset);
for(i = 0 ; i < nb_trace ; i++) {
/* restore the closest earlier saved state */
if(min_pos != -1) {
- if(ltt_time_compare(restored_time, closest_tree_time) == 0) {
-
+ if(first_restored_time || (ltt_time_compare(restored_time, closest_tree_time) == 0)) {
+ first_restored_time = 0;
lttv_state_restore(tstate, closest_tree);
restored_time = closest_tree_time;