a_test5,
a_test6,
a_test7,
+ a_test8,
a_test_all;
static GQuark QUARK_BLOCK_START,
}
}
+ /* Seek at specified interval, using states computed in 6, making
+ * sure that there is no more than the number of events between
+ * state save interval to read before getting there.
+ */
+
+ if((a_test8 && a_test6) || a_test_all) {
+ g_message("Running test 8 : check save interval");
+ LttTime time = tc->time_span.start_time;
+ LttTime interval;
+ interval.tv_sec = 0;
+ interval.tv_nsec = 175674987;
+ guint count;
+
+ while(ltt_time_compare(time, tc->time_span.end_time) < 0) {
+ //g_message("Seeking at time %u.%u", time.tv_sec, time.tv_nsec);
+ lttv_process_traceset_seek_time(&ts->parent, ltt_time_zero);
+ lttv_state_traceset_seek_time_closest(ts, time);
+ /* We add no hook to the traceset, not necessary */
+ count = lttv_process_traceset_middle(&ts->parent,
+ time, G_MAXUINT, NULL);
+ g_info("Number of events to jump over : %u", count);
+
+ if(count > LTTV_STATE_SAVE_INTERVAL)
+ g_warning("Oops! Save interval is %u and it took %u events to seek to a time %lu.%lu supposed to be closer from the last saved state.",
+ LTTV_STATE_SAVE_INTERVAL, count, time.tv_sec, time.tv_nsec);
+ time = ltt_time_add(time, interval);
+ }
+
+ }
+
if(a_trace_event) lttv_hooks_remove_data(event_hook, trace_event, NULL);
g_free(save_state.write_time);
lttv_option_add("test7", '7', "Test seeking to positions written out in 3",
"", LTTV_OPT_NONE, &a_test7, NULL, NULL);
+ a_test8 = FALSE;
+ lttv_option_add("test8", '8', "Test seeking to positions using saved states computed at 6 : check if number of events fits",
+ "", LTTV_OPT_NONE, &a_test8, NULL, NULL);
+
a_test_all = FALSE;
lttv_option_add("testall", 'a', "Run all tests ", "",
LTTV_OPT_NONE, &a_test_all, NULL, NULL);
lttv_option_remove("test5");
lttv_option_remove("test6");
lttv_option_remove("test7");
+ lttv_option_remove("test8");
lttv_option_remove("testall");
lttv_hooks_destroy(before_traceset);
value = lttv_attribute_add(container, LTTV_STATE_RUNNING_PROCESS,
LTTV_POINTER);
*(value.v_pointer) = running_process;
-
+
+ g_info("State save");
nb_tracefile = self->parent.tracefiles->len;
guint64 tsc;
LttTracefile *tf;
ltt_event_position_get(ep, &tf, &nb_block, &offset, &tsc);
- g_debug("Block %u offset %u tsc %llu time %lu.%lu", nb_block, offset,
+ g_info("Block %u offset %u tsc %llu time %lu.%lu", nb_block, offset,
tsc,
tfcs->parent.timestamp.tv_sec, tfcs->parent.timestamp.tv_nsec);
}
tfc->timestamp = ltt_event_time(ltt_tracefile_get_event(tfc->tf));
g_assert(ltt_time_compare(tfc->timestamp, ltt_time_infinite) != 0);
g_tree_insert(tsc->pqueue, tfc, tfc);
+ g_info("Restoring state for a tf at time %lu.%lu", tfc->timestamp.tv_sec, tfc->timestamp.tv_nsec);
} else {
tfc->timestamp = ltt_time_infinite;
}
/* Free running processes array */
nb_cpus = ltt_trace_get_num_cpu(self->parent.t);
- type = lttv_attribute_get_by_name(tracefile_tree, LTTV_STATE_RUNNING_PROCESS,
+ type = lttv_attribute_get_by_name(container, LTTV_STATE_RUNNING_PROCESS,
&value);
g_assert(type == LTTV_POINTER);
running_process = *(value.v_pointer);
return 0;
}
+static guint test_event_count = 0;
void lttv_state_remove_event_hooks(LttvTracesetState *self)
{
LttvTraceset *traceset = self->parent.ts;
lttv_trace_hook_destroy(&g_array_index(hooks, LttvTraceHook, k));
g_array_free(hooks, TRUE);
}
+ g_info("EVENT COUNT TEST : %u", test_event_count);
}
-static guint test_event_count = 0;
static gboolean state_save_event_hook(void *hook_data, void *call_data)
{
guint *event_count = (guint*)hook_data;
}
g_free(event_count);
}
- g_info("EVENT COUNT TEST : %u", test_event_count);
}
gint lttv_state_save_hook_remove_event_hooks(void *hook_data, void *call_data)
int min_pos, mid_pos, max_pos;
+ guint call_rest = 0;
+
LttvTraceState *tcs;
LttvAttributeValue value;
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);
+
nb_trace = lttv_traceset_number(traceset);
for(i = 0 ; i < nb_trace ; i++) {
tcs = (LttvTraceState *)self->parent.traces[i];
/* restore the closest earlier saved state */
if(min_pos != -1) {
lttv_state_restore(tcs, closest_tree);
+ call_rest = 1;
}
/* There is no saved state, yet we want to have it. Restart at T0 */
lttv_process_trace_seek_time(&(tcs->parent), t);
}
}
+ if(!call_rest) g_info("NOT Calling restore");
}
{
guint i;
guint num_traces = lttv_traceset_number(self->ts);
-
+
+ pos->tfc = g_array_set_size(pos->tfc, 0);
+ pos->ep = g_array_set_size(pos->ep, 0);
+
for(i=0; i<num_traces;i++) {
GArray * tracefiles = self->traces[i]->tracefiles;
guint j;
int i;
LttEventPosition **src_ep, **dest_ep;
- g_array_set_size(dest->ep, src->ep->len);
- g_array_set_size(dest->tfc, src->tfc->len);
+ dest->ep = g_array_set_size(dest->ep, src->ep->len);
+ dest->tfc = g_array_set_size(dest->tfc, src->tfc->len);
for(i=0;i<src->ep->len;i++) {
src_ep = &g_array_index(src->ep, LttEventPosition*, i);