} while(1);
fclose(fp);
+
// saved_states : open, test
strncpy(path, trace_path, PATH_MAX-1);
count = strnlen(trace_path, PATH_MAX-1);
/* We must link to the parent */
parent_process = lttv_state_find_process_or_create(self, ANY_CPU, tmp.ppid,
<t_time_zero);
- process = lttv_state_find_process_or_create(self, tmp.cpu, tmp.pid,
- &tmp.creation_time);
+ process = lttv_state_find_process(self, ANY_CPU, tmp.pid);
+ if(process == NULL) {
+ process = lttv_state_create_process(self, parent_process, tmp.cpu,
+ tmp.pid, tmp.tgid,
+ g_quark_from_string((gchar*)g_ptr_array_index(quarktable, tmp.name)),
+ &tmp.creation_time);
+ }
}
process->insertion_time = tmp.insertion_time;
process->creation_time = tmp.creation_time;
process->name =
g_quark_from_string((gchar*)g_ptr_array_index(quarktable, tmp.name));
+
do {
if(feof(fp) || ferror(fp)) goto end_loop;
process->execution_stack->len + 1);
es = &g_array_index(process->execution_stack, LttvExecutionState,
process->execution_stack->len-1);
+ process->state = es;
fread(&es->t, sizeof(es->t), 1, fp);
es->t = g_quark_from_string(
LttvAttribute *saved_states_tree, *saved_state_tree;
LttvAttributeValue value;
+ GTree *pqueue = self->parent.ts_context->pqueue;
ep = ltt_event_position_new();
restore_init_state(self);
// fprintf(fp, " <TRACEFILE TIMESTAMP_S=%lu TIMESTAMP_NS=%lu",
// tfcs->parent.timestamp.tv_sec,
// tfcs->parent.timestamp.tv_nsec);
+ g_tree_remove(pqueue, &tfcs->parent);
hdr = fgetc(fp);
g_assert(hdr == HDR_TRACEFILE);
fread(&tfcs->parent.timestamp, sizeof(tfcs->parent.timestamp), 1, fp);
ltt_event_position_set(ep, tfcs->parent.tf, nb_block, offset, tsc);
gint ret = ltt_tracefile_seek_position(tfcs->parent.tf, ep);
g_assert(ret == 0);
+ g_tree_insert(pqueue, &tfcs->parent, &tfcs->parent);
}
}
g_free(ep);
t.tv_nsec);
*(self->max_time_state_recomputed_in_seek) = t;
+
}
/* Called when a HDR_TRACE is found */
};
} while(1);
end_loop:
-
*(tcs->max_time_state_recomputed_in_seek) = tcs->parent.time_span.end_time;
+ restore_init_state(tcs);
+ lttv_process_trace_seek_time(tcs, ltt_time_zero);
+ return;
}
//g_assert(timestamp->tv_sec != 0);
es->change = *timestamp;
es->cum_cpu_time = ltt_time_zero;
- es->s = LTTV_STATE_WAIT_FORK;
+ es->s = LTTV_STATE_MODE_UNKNOWN;
/* Allocate an empty function call stack. If it's empty, use 0x0. */
process->user_stack = g_array_sized_new(FALSE, FALSE,
child_process = lttv_state_create_process(ts, process, cpu,
child_pid, child_tgid,
LTTV_STATE_UNNAMED, &s->parent.timestamp);
+ child_process->state->s = LTTV_STATE_WAIT_FORK;
} else {
/* The process has already been created : due to time imprecision between
* multiple CPUs : it has been scheduled in before creation. Note that we
/* Keep the stack bottom : a running user mode */
/* Disabled because of inconsistencies in the current statedump states. */
if(type == LTTV_STATE_KERNEL_THREAD) {
- /* Only keep the bottom */
+ /* Only keep the bottom
+ * FIXME Kernel thread : can be in syscall or interrupt or trap. */
+ /* Will cause expected trap when in fact being syscall (even after end of
+ * statedump event)
+ * Will cause expected interrupt when being syscall. (only before end of
+ * statedump event) */
+ // This will cause a "popping last state on stack, ignoring it."
process->execution_stack = g_array_set_size(process->execution_stack, 1);
es = process->state = &g_array_index(process->execution_stack,
LttvExecutionState, 0);
es->s = status;
es->n = submode;
} else {
- /* On top of it : */
+ /* User space process :
+ * bottom : user mode
+ * either currently running or scheduled out.
+ * can be scheduled out because interrupted in (user mode or in syscall)
+ * or because of an explicit call to the scheduler in syscall. Note that
+ * the scheduler call comes after the irq_exit, so never in interrupt
+ * context. */
+ // temp workaround : set size to 1 : only have user mode bottom of stack.
+ // will cause g_info message of expected syscall mode when in fact being
+ // in user mode. Can also cause expected trap when in fact being user
+ // mode in the event of a page fault reenabling interrupts in the handler.
+ // Expected syscall and trap can also happen after the end of statedump
+ // This will cause a "popping last state on stack, ignoring it."
+ process->execution_stack = g_array_set_size(process->execution_stack, 1);
+#if 0
es = process->state = &g_array_index(process->execution_stack,
LttvExecutionState, 1);
es->t = LTTV_STATE_USER_MODE;
es->s = status;
es->n = submode;
+#endif //0
}
#if 0
/* UNKNOWN STATE */
for(i = 0 ; i < nb_trace ; i++) {
ts = (LttvTraceState *)self->parent.traces[i];
- if(ts->has_precomputed_states) continue;
-
/* Find the eventtype id for the following events and register the
associated by id hooks. */
for(i = 0 ; i < nb_trace ; i++) {
ts = LTTV_TRACE_STATE(self->parent.traces[i]);
- if(ts->has_precomputed_states) continue;
-
lttv_attribute_find(ts->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val);
hooks = *(val.v_pointer);
ts = (LttvTraceState *)self->parent.traces[i];
nb_tracefile = ts->parent.tracefiles->len;
+ if(ts->has_precomputed_states) continue;
+
guint *event_count = g_new(guint, 1);
*event_count = 0;
ts = (LttvTraceState *)self->parent.traces[i];
nb_tracefile = ts->parent.tracefiles->len;
+ if(ts->has_precomputed_states) continue;
+
guint *event_count = NULL;
for(j = 0 ; j < nb_tracefile ; j++) {