LttTracefile *tracefile, *tf;
- LttEvent *event;
+ LttEvent *event = ltt_event_new();
LttFacility *facility;
ltt_tracefile_seek_time(tracefile, zero_time);
previous_time = zero_time;
nb_equal = 0;
- while((event = ltt_tracefile_read(tracefile)) != NULL) {
+ while((ltt_tracefile_read(tracefile, event)) != NULL) {
facility = ltt_event_facility(event);
event_type = ltt_event_eventtype(event);
time = ltt_event_time(event);
g_free(a_event_position);
lttv_context_fini(tc);
g_object_unref(tscs);
+ ltt_event_destroy(event);
if(lttv_profile_memory) {
g_message("Memory summary at the end of batchtest");
LttvTracefileState *tfcs;
- LttTime null_time = {0,0};
-
if(self->processes != NULL) lttv_state_free_process_table(self->processes);
self->processes = g_hash_table_new(process_hash, process_equal);
self->nb_event = 0;
for(i = 0 ; i < nb_tracefile ; i++) {
tfcs = LTTV_TRACEFILE_STATE(self->parent.tracefiles[i]);
- tfcs->parent.timestamp = null_time;
+ ltt_trace_time_span_get(self->parent.t, &tfcs->parent.timestamp, NULL);
tfcs->saved_position = 0;
tfcs->process = lttv_state_create_process(tfcs, NULL,0);
tfcs->process->state->s = LTTV_STATE_RUN;
es->t = LTTV_STATE_USER_MODE;
es->n = LTTV_STATE_SUBMODE_NONE;
es->entry = tfs->parent.timestamp;
+ g_assert(tfs->parent.timestamp.tv_sec != 0);
es->change = tfs->parent.timestamp;
es->s = LTTV_STATE_WAIT_FORK;
LttvTraceHook hook_start, hook_end;
+ lttv_state_add_event_hooks(self);
+
nb_trace = lttv_traceset_number(traceset);
for(i = 0 ; i < nb_trace ; i++) {
ts = (LttvTraceState *)self->parent.traces[i];
tfs->parent.event_by_id, hook_end.id), hook_end.h, NULL);
}
}
+
+ lttv_state_remove_event_hooks(self);
}
gint lttv_state_save_hook_remove_event_hooks(void *hook_data, void *call_data)
sufficient for the analysis, and possibly organized quite differently.
The state information is added to LttvTracesetContext, LttvTraceContext
- and LttvTracefileContext objects, used by processTrace, through
+ and LttvTracefileContext objects, used by process_traceset, through
subtyping. The context objects already reflect the multiple tracefiles
(one per cpu) per trace and multiple traces per trace set. The state
objects defined here simply add fields to the relevant context objects.
/* opened file descriptors, address map?... */
} LttvProcessState;
-
LttvProcessState *
lttv_state_find_process(LttvTracefileState *tfs, guint pid);
LTTV_TRACESET_CONTEXT_CLASS(g_type_class_peek(LTTV_TRACESET_STATE_TYPE))->
init((LttvTracesetContext *)self, ts);
- self->stats =lttv_attribute_find_subdir(self->parent.parent.ts_a,LTTV_STATS);
- lttv_attribute_find(self->parent.parent.ts_a, LTTV_STATS_USE_COUNT,
- LTTV_UINT, &v);
+ self->stats = lttv_attribute_find_subdir(
+ lttv_traceset_attribute(self->parent.parent.ts),
+ LTTV_STATS);
+ lttv_attribute_find(lttv_traceset_attribute(self->parent.parent.ts),
+ LTTV_STATS_USE_COUNT,
+ LTTV_UINT, &v);
*(v.v_uint)++;
if(*(v.v_uint) == 1) {
}
}
-
static void
fini(LttvTracesetStats *self)
{
void
lttv_stats_sum_trace(LttvTraceStats *self)
{
- LttvTraceStats *tcs;
+ LttvAttribute *sum_container = self->stats;
LttvAttributeType type;
*cpu_events_tree, *process_modes_tree, *trace_cpu_tree,
*trace_modes_tree;
- main_tree = self->stats;
+ main_tree = sum_container;
- lttv_attribute_find(self->parent.parent.t_a, LTTV_STATS_SUMMED,
- LTTV_UINT, &value);
+ lttv_attribute_find(sum_container,
+ LTTV_STATS_SUMMED,
+ LTTV_UINT, &value);
if(*(value.v_uint) != 0) return;
*(value.v_uint) = 1;
processes_tree = lttv_attribute_find_subdir(main_tree,
- LTTV_STATS_PROCESSES);
- trace_modes_tree = lttv_attribute_find_subdir(main_tree, LTTV_STATS_MODES);
+ LTTV_STATS_PROCESSES);
+ trace_modes_tree = lttv_attribute_find_subdir(main_tree,
+ LTTV_STATS_MODES);
nb_process = lttv_attribute_get_number(processes_tree);
for(i = 0 ; i < nb_process ; i++) {
}
+gboolean lttv_stats_sum_traceset_hook(void *hook_data, void *call_data)
+{
+ lttv_stats_sum_traceset((LttvTracesetStats *)call_data);
+ return 0;
+}
+
void
lttv_stats_sum_traceset(LttvTracesetStats *self)
{
LttvTraceset *traceset = self->parent.parent.ts;
+ LttvAttribute *sum_container = self->stats;
LttvTraceStats *tcs;
LttvAttributeValue value;
- lttv_attribute_find(self->parent.parent.ts_a, LTTV_STATS_SUMMED,
+ lttv_attribute_find(sum_container, LTTV_STATS_SUMMED,
LTTV_UINT, &value);
if(*(value.v_uint) != 0) return;
*(value.v_uint) = 1;
- traceset_modes_tree = lttv_attribute_find_subdir(self->stats,
+ traceset_modes_tree = lttv_attribute_find_subdir(sum_container,
LTTV_STATS_MODES);
nb_trace = lttv_traceset_number(traceset);
}
+// Hook wrapper. call_data is a traceset context.
+gint lttv_stats_hook_add_event_hooks(void *hook_data, void *call_data)
+{
+ LttvTracesetStats *tss = (LttvTracesetStats*)call_data;
+
+ lttv_stats_add_event_hooks(tss);
+
+ return 0;
+}
+
lttv_stats_add_event_hooks(LttvTracesetStats *self)
{
LttvTraceset *traceset = self->parent.parent.ts;
LttvAttributeValue val;
+ lttv_state_add_event_hooks(&self->parent);
+
nb_trace = lttv_traceset_number(traceset);
for(i = 0 ; i < nb_trace ; i++) {
ts = (LttvTraceStats *)self->parent.parent.traces[i];
}
}
+// Hook wrapper. call_data is a traceset context.
+gint lttv_stats_hook_remove_event_hooks(void *hook_data, void *call_data)
+{
+ LttvTracesetStats *tss = (LttvTracesetStats*)call_data;
+
+ lttv_stats_remove_event_hooks(tss);
+
+ return 0;
+}
lttv_stats_remove_event_hooks(LttvTracesetStats *self)
{
g_array_free(before_hooks, TRUE);
g_array_free(after_hooks, TRUE);
}
+ lttv_state_remove_event_hooks(&self->parent);
}
typedef struct _LttvTracefileStats LttvTracefileStats;
typedef struct _LttvTracefileStatsClass LttvTracefileStatsClass;
+
+
+// Hook wrapper. call_data is a trace context.
+gint lttv_stats_hook_add_event_hooks(void *hook_data, void *call_data);
gboolean lttv_stats_add_event_hooks(LttvTracesetStats *self);
+// Hook wrapper. call_data is a trace context.
+gint lttv_stats_hook_remove_event_hooks(void *hook_data, void *call_data);
gboolean lttv_stats_remove_event_hooks(LttvTracesetStats *self);
+gboolean lttv_stats_sum_traceset_hook(void *hook_data, void *call_data);
void lttv_stats_sum_traceset(LttvTracesetStats *self);
void lttv_stats_sum_trace(LttvTraceStats *self);
tfc->tf = ltt_trace_per_cpu_tracefile_get(tc->t, j - nb_control);
}
tfc->t_context = tc;
+ tfc->e = ltt_event_new();
tfc->event = lttv_hooks_new();
tfc->event_by_id = lttv_hooks_by_id_new();
tfc->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
for(j = 0 ; j < nb_tracefile ; j++) {
tfc = tc->tracefiles[j];
+ ltt_event_destroy(tfc->e);
lttv_hooks_destroy(tfc->event);
lttv_hooks_by_id_destroy(tfc->event_by_id);
g_object_unref(tfc->a);
LttvTracefileContext *tfc;
- LttEvent *event;
-
unsigned count = 0;
gboolean last_ret = FALSE; /* return value of the last hook list called */
last_ret = lttv_hooks_call_merge(tfc->event, tfc,
lttv_hooks_by_id_get(tfc->event_by_id, id), tfc);
- event = ltt_tracefile_read(tfc->tf);
- if(event != NULL) {
- tfc->e = event;
- tfc->timestamp = ltt_event_time(event);
+ if(ltt_tracefile_read(tfc->tf, tfc->e) != NULL) {
+ tfc->timestamp = ltt_event_time(tfc->e);
g_tree_insert(pqueue, tfc, tfc);
}
}
LttvTracefileContext *tfc;
- LttEvent *event;
-
GTree *pqueue = self->ts_context->pqueue;
nb_tracefile = ltt_trace_control_tracefile_number(self->t) +
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);
+ if(ltt_tracefile_read(tfc->tf, tfc->e) != NULL) {
+ tfc->timestamp = ltt_event_time(tfc->e);
g_tree_insert(pqueue, tfc, tfc);
}
}
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);
+ if(ltt_tracefile_read(tfc->tf, tfc->e) != NULL) {
+ tfc->timestamp = ltt_event_time(tfc->e);
g_tree_insert(pqueue, tfc, tfc);
}