if(*(value.v_pointer) == NULL) tfcs->parent.e = NULL;
else {
ep = *(value.v_pointer);
- ltt_tracefile_seek_position(tfcs->parent.tf, ep);
- tfcs->parent.e = ltt_tracefile_read(tfcs->parent.tf);
- tfcs->parent.timestamp = ltt_event_time(tfcs->parent.e);
+ lttv_process_tracefile_seek_position(tfcs->parent, ep);
}
}
}
char buffer[128];
- tcs = ((LttvTraceState *)tc = tfs->parent.t_context);
+ tc = tfs->parent.t_context;
+ tcs = (LttvTraceState *)tc;
process->pid = pid;
process->last_cpu = tfs->cpu_name;
lttv_trace_find_hook(ts->parent.t, "core", "process_exit", NULL, NULL,
NULL, process_exit, &g_array_index(hooks, LttvTraceHook, 8));
- /* Add these hooks to each before_event_by_id hooks list */
+ /* Add these hooks to each event_by_id hooks list */
nb_tracefile = ltt_trace_control_tracefile_number(ts->parent.t) +
ltt_trace_per_cpu_tracefile_number(ts->parent.t);
for(k = 0 ; k < hooks->len ; k++) {
hook = g_array_index(hooks, LttvTraceHook, k);
- lttv_hooks_add(lttv_hooks_by_id_find(tfs->parent.after_event_by_id,
- hook.id), hook.h, &g_array_index(hooks, LttvTraceHook, k));
+ lttv_hooks_add(lttv_hooks_by_id_find(tfs->parent.event_by_id,
+ hook.id), hook.h, &g_array_index(hooks, LttvTraceHook, k), LTTV_PRIO_STATE);
}
}
lttv_attribute_find(self->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val);
lttv_attribute_find(self->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val);
hooks = *(val.v_pointer);
- /* Add these hooks to each before_event_by_id hooks list */
+ /* Remove these hooks from each event_by_id hooks list */
nb_tracefile = ltt_trace_control_tracefile_number(ts->parent.t) +
ltt_trace_per_cpu_tracefile_number(ts->parent.t);
for(k = 0 ; k < hooks->len ; k++) {
hook = g_array_index(hooks, LttvTraceHook, k);
lttv_hooks_remove_data(
- lttv_hooks_by_id_find(tfs->parent.after_event_by_id,
+ lttv_hooks_by_id_find(tfs->parent.event_by_id,
hook.id), hook.h, &g_array_index(hooks, LttvTraceHook, k));
}
}
for(j = 0 ; j < nb_tracefile ; j++) {
tfs = LTTV_TRACEFILE_STATE(ts->parent.tracefiles[j]);
- lttv_hooks_add(lttv_hooks_by_id_find(tfs->parent.after_event_by_id,
- hook_start.id), hook_start.h, NULL);
- lttv_hooks_add(lttv_hooks_by_id_find(tfs->parent.after_event_by_id,
- hook_end.id), hook_end.h, NULL);
+ lttv_hooks_add(lttv_hooks_by_id_find(tfs->parent.event_by_id,
+ hook_start.id), hook_start.h, NULL, LTTV_PRIO_STATE);
+ lttv_hooks_add(lttv_hooks_by_id_find(tfs->parent.event_by_id,
+ hook_end.id), hook_end.h, NULL, LTTV_PRIO_STATE);
}
}
}
for(j = 0 ; j < nb_tracefile ; j++) {
tfs = LTTV_TRACEFILE_STATE(ts->parent.tracefiles[j]);
lttv_hooks_remove_data(lttv_hooks_by_id_find(
- tfs->parent.after_event_by_id, hook_start.id), hook_start.h, NULL);
+ tfs->parent.event_by_id, hook_start.id), hook_start.h, NULL);
lttv_hooks_remove_data(lttv_hooks_by_id_find(
- tfs->parent.after_event_by_id, hook_end.id), hook_end.h, NULL);
+ tfs->parent.event_by_id, hook_end.id), hook_end.h, NULL);
}
}
}
}
lttv_process_traceset_seek_time(self, null_time);
lttv_traceset_context_compute_time_span(self, &self->time_span);
- self->e = NULL;
self->pqueue = g_tree_new(compare_tracefile);
}
LttEvent *event;
+ GTree *pqueue = self->ts_context->pqueue;
+
nb_tracefile = ltt_trace_control_tracefile_number(self->t) +
ltt_trace_per_cpu_tracefile_number(self->t);
for(i = 0 ; i < nb_tracefile ; i++) {
tfc = self->tracefiles[i];
ltt_tracefile_seek_time(tfc->tf, start);
+ g_tree_remove(pqueue, tfc);
event = ltt_tracefile_read(tfc->tf);
tfc->e = event;
if(event != NULL) {
tfc->timestamp = ltt_event_time(event);
- g_tree_insert(self->ts_context->pqueue, tfc, tfc);
+ g_tree_insert(pqueue, tfc, tfc);
}
}
}
LttvTracefileContext *tfc;
- /* Empty the pqueue */
-
- while(TRUE){
- tfc = NULL;
- g_tree_foreach(self->pqueue, get_first, &tfc);
- if(tfc == NULL) break;
- g_tree_remove(self->pqueue, &(tfc->timestamp));
- }
-
nb_trace = lttv_traceset_number(self->ts);
for(i = 0 ; i < nb_trace ; i++) {
tc = self->traces[i];
}
+gboolean lttv_process_tracefile_seek_position(LttvTracefileContext *self,
+ const LttEventPosition *pos)
+{
+ LttvTracefileContext *tfc = self;
+
+ LttEvent *event;
+
+ GTree *pqueue = self->t_context->ts_context->pqueue;
+
+ ltt_tracefile_seek_position(tfc->tf, pos);
+ g_tree_remove(pqueue, tfc);
+ event = ltt_tracefile_read(tfc->tf);
+ tfc->e = event;
+ if(event != NULL) {
+ tfc->timestamp = ltt_event_time(event);
+ g_tree_insert(pqueue, tfc, tfc);
+ }
+
+
+}
+
gboolean lttv_process_trace_seek_position(LttvTraceContext *self,
const LttvTraceContextPosition *pos)
{
for(i = 0 ; i < nb_tracefile ; i++) {
tfc = self->tracefiles[i];
- ltt_tracefile_seek_position(tfc->tf, pos->tf_pos[i]);
- event = ltt_tracefile_read(tfc->tf);
- tfc->e = event;
- if(event != NULL) {
- tfc->timestamp = ltt_event_time(event);
- g_tree_insert(self->ts_context->pqueue, tfc, tfc);
- }
+ lttv_process_tracefile_seek_position(tfc, pos->tf_pos[i]);
}
return TRUE;
if(nb_trace != pos->nb_trace)
return FALSE; /* Error */
- /* Empty the pqueue */
-
- while(TRUE){
- tfc = NULL;
- g_tree_foreach(self->pqueue, get_first, &tfc);
- if(tfc == NULL) break;
- g_tree_remove(self->pqueue, &(tfc->timestamp));
- }
-
for(i = 0 ; i < nb_trace ; i++) {
tc = self->traces[i];
sum_ret = sum_ret && lttv_process_trace_seek_position(tc, &pos->t_pos[i]);