if(likely((*event_count)++ < LTTV_STATE_SAVE_INTERVAL))
return FALSE;
else
- event_count = 0;
+ *event_count = 0;
LttvTracefileState *self = (LttvTracefileState *)call_data;
ts = (LttvTraceState *)self->parent.traces[i];
nb_tracefile = ts->parent.tracefiles->len;
- guint *event_count = g_new(guint, 1);
- *event_count = 0;
-
for(j = 0 ; j < nb_tracefile ; j++) {
+ guint *event_count = g_new(guint, 1);
+ *event_count = 0;
tfs =
LTTV_TRACEFILE_STATE(g_array_index(ts->parent.tracefiles,
LttvTracefileContext*, j));
GArray *ep; /* Array of LttEventPosition */
GArray *tfc; /* Array of corresponding
TracefileContext* */
- LttTime timestamp; /* Current time at the saved position */
+ LttTime timestamp; /* Current time at the saved position */
+ /* If ltt_time_infinite : no position is
+ * set, else, a position is set (may be end
+ * of trace, with ep->len == 0) */
};
void lttv_context_init(LttvTracesetContext *self, LttvTraceset *ts)
self->traces = g_new(LttvTraceContext *, nb_trace);
self->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
self->ts_a = lttv_traceset_attribute(ts);
- // self->sync_position = lttv_traceset_context_position_new();
+ self->sync_position = lttv_traceset_context_position_new();
for(i = 0 ; i < nb_trace ; i++) {
tc = LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_trace_context(self);
self->traces[i] = tc;
g_tree_destroy(self->pqueue);
g_object_unref(self->a);
- // lttv_traceset_context_position_destroy(self->sync_position);
+ lttv_traceset_context_position_destroy(self->sync_position);
nb_trace = lttv_traceset_number(ts);
const LttvTracesetContextPosition *pos)
{
guint i;
-
- g_tree_destroy(self->pqueue);
- self->pqueue = g_tree_new(compare_tracefile);
- for(i=0;i<pos->ep->len; i++) {
- LttEventPosition **ep = &g_array_index(pos->ep, LttEventPosition*, i);
- LttvTracefileContext **tfc =
- &g_array_index(pos->tfc, LttvTracefileContext*, i);
- if(*ep != NULL) {
- if(ltt_tracefile_seek_position((*tfc)->tf, *ep) != 0)
- return 1;
- (*tfc)->timestamp = ltt_event_time(ltt_tracefile_get_event((*tfc)->tf));
- g_tree_insert(self->pqueue, (*tfc), (*tfc));
- } else {
- (*tfc)->timestamp = ltt_time_infinite;
+ /* If a position is set, seek the traceset to this position */
+ if(ltt_time_compare(pos->timestamp, ltt_time_infinite) != 0) {
+ g_tree_destroy(self->pqueue);
+ self->pqueue = g_tree_new(compare_tracefile);
+
+ for(i=0;i<pos->ep->len; i++) {
+ LttEventPosition **ep = &g_array_index(pos->ep, LttEventPosition*, i);
+ LttvTracefileContext **tfc =
+ &g_array_index(pos->tfc, LttvTracefileContext*, i);
+ if(*ep != NULL) {
+ if(ltt_tracefile_seek_position((*tfc)->tf, *ep) != 0)
+ return 1;
+ (*tfc)->timestamp = ltt_event_time(ltt_tracefile_get_event((*tfc)->tf));
+ g_tree_insert(self->pqueue, (*tfc), (*tfc));
+ } else {
+ (*tfc)->timestamp = ltt_time_infinite;
+ }
}
}
return 0;
return tfc;
}
-#if 0
+
/* lttv_process_traceset_synchronize_tracefiles
*
* Use the sync_position field of the trace set context to synchronize each
lttv_traceset_context_position_save(tsc, tsc->sync_position);
}
-#endif //0
-