- g_datalist_foreach(tracefiles_groups,
- (GDataForeachFunc)compute_tracefile_group,
- &args);
-
- }
- }
-
- tscs = g_object_new(LTTV_TRACESET_STATS_TYPE, NULL);
- ts = &tscs->parent;
- tc = &tscs->parent.parent;
-
- lttv_context_init(tc, traceset);
-
- /* For each case compute and print the elapsed time.
- The first case is simply to run through all events with a
- simple counter. */
-
- if(a_test1 || a_test_all) {
- count = 0;
- lttv_hooks_add(event_hook, count_event, &count, LTTV_PRIO_DEFAULT);
- t = run_one_test(ts, ltt_time_zero, max_time);
- lttv_hooks_remove_data(event_hook, count_event, &count);
- g_message(
- "Processing trace while counting events (%u events in %g seconds)",
- count, t);
- }
-
- /* Run through all events computing the state. */
-
- if(a_test2 || a_test_all) {
- lttv_state_add_event_hooks(ts);
- t = run_one_test(ts, ltt_time_zero, max_time);
- lttv_state_remove_event_hooks(ts);
- g_message("Processing trace while updating state (%g seconds)", t);
- }
-
- /* Run through all events computing the state and writing it out
- periodically. */
-
- SaveState save_state;
-
- save_state.interval = a_sample_interval;
- save_state.size = a_sample_number;
- save_state.fp = stderr;
- save_state.write_time = g_new(LttTime, a_sample_number);
-
-
- if(a_test3 || a_test_all) {
- for(i = 0 ; i < 2 ; i++) {
- save_state.count = 0;
- save_state.position = 0;
- save_state.version = i;
- lttv_state_add_event_hooks(ts);
- lttv_hooks_add(event_hook, save_state_event, &save_state,
- LTTV_PRIO_DEFAULT);
- t = run_one_test(ts, ltt_time_zero, max_time);
- lttv_state_remove_event_hooks(ts);
- lttv_hooks_remove_data(event_hook, save_state_event, &save_state);
- g_warning("Processing while updating/writing state (%g seconds)", t);
- }
- }
-
- /* Run through all events computing the stats. */
-
- if(a_test4 || a_test_all) {
- if(lttv_profile_memory) {
- g_message("Memory summary before computing stats");
- g_mem_profile();
- }
-
- lttv_stats_add_event_hooks(tscs);
- t = run_one_test(ts, ltt_time_zero, max_time);
- lttv_stats_remove_event_hooks(tscs);
- g_message("Processing trace while counting stats (%g seconds)", t);
-
- if(lttv_profile_memory) {
- g_message("Memory summary after computing stats");
- g_mem_profile();
- }
-
- lttv_stats_sum_traceset(tscs, ltt_time_infinite);
-
- if(lttv_profile_memory) {
- g_message("Memory summary after summing stats");
- g_mem_profile();
- }
-
- lttv_context_fini(tc);
- lttv_context_init(tc, traceset);
-
- if(lttv_profile_memory) {
- g_message("Memory summary after cleaning up the stats");
- g_mem_profile();
- }
- }
-
- /* Run through all events computing the state and stats. */
-
- if(a_test5 || a_test_all) {
- if(lttv_profile_memory) {
- g_message("Memory summary before computing state and stats");
- g_mem_profile();
- }
-
- lttv_state_add_event_hooks(ts);
- lttv_stats_add_event_hooks(tscs);
- t = run_one_test(ts, ltt_time_zero, max_time);
- lttv_state_remove_event_hooks(ts);
- lttv_stats_remove_event_hooks(tscs);
- g_message(
- "Processing trace while counting state and stats (%g seconds)", t);
-
- if(lttv_profile_memory) {
- g_message("Memory summary after computing and state and stats");
- g_mem_profile();
- }
-
- lttv_context_fini(tc);
- lttv_context_init(tc, traceset);
-
- if(lttv_profile_memory) {
- g_message("Memory summary after cleaning up the stats");
- g_mem_profile();
- }
- }
-
- /* Run through all events computing and saving the state. */
-
- if(a_trace_event) lttv_hooks_add(event_hook, trace_event, NULL,
- LTTV_PRIO_DEFAULT);
-
- if(a_test6 || a_test_all) {
- if(lttv_profile_memory) {
- g_message("Memory summary before computing and saving state");
- g_mem_profile();
- }
-
- lttv_state_add_event_hooks(ts);
- lttv_state_save_add_event_hooks(ts);
- if(a_save_state_copy)
- lttv_hooks_add(event_hook, save_state_copy_event, &save_state,
- LTTV_PRIO_DEFAULT);
- t = run_one_test(ts, ltt_time_zero, max_time);
- lttv_state_remove_event_hooks(ts);
- lttv_state_save_remove_event_hooks(ts);
- if(a_save_state_copy)
- lttv_hooks_remove_data(event_hook,save_state_copy_event, &save_state);
-
- g_message("Processing trace while updating/saving state (%g seconds)", t);
-
- if(lttv_profile_memory) {
- g_message("Memory summary after computing/saving state");
- g_mem_profile();
- }
- }
-
- /* Seek a few times to each saved position */
-
- if((a_test7 && a_test3) || a_test_all) {
- g_assert(a_seek_number >= 0);
- for(i = 0 ; i < (guint)a_seek_number ; i++) {
- gint reverse_j; /* just to make sure j is unsigned */
- for(reverse_j = save_state.position - 1 ; reverse_j >= 0 ; reverse_j--) {
- j = (guint)reverse_j;
- lttv_state_add_event_hooks(ts);
- t = run_one_test(ts, save_state.write_time[j],
- save_state.write_time[j]);
- lttv_state_remove_event_hooks(ts);
- g_message("Seeking to %lu.%lu (%g seconds)",
- save_state.write_time[j].tv_sec, save_state.write_time[j].tv_nsec,
- t);
-
- if(a_save_sample != NULL) {
- filename = g_string_new("");
- g_string_printf(filename, "%s.%d.xml.bak%d", a_save_sample, j, i);
- fp = fopen(filename->str, "w");
- if(fp == NULL) g_error("Cannot open %s", filename->str);
- g_string_free(filename, TRUE);
- lttv_state_write((LttvTraceState *)tc->traces[0],
- save_state.write_time[j], fp);
- fclose(fp);
- }
- //else lttv_state_write((LttvTraceState *)tc->traces[0],
- // save_state.write_time[j], save_state.fp);
- }
- }
- }
-
- /* 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_test9 || a_test_all) {
- double t0, t1;
- /* Run seek_forward and seek_backward test */
- guint count;
- LttvTracesetContext *tsc = &ts->parent;
- LttvTracesetContextPosition *saved_pos =
- lttv_traceset_context_position_new(tsc);
- g_message("Running test 9 : seek_forward and seek_backward");
- lttv_process_traceset_seek_time(tsc, ltt_time_zero);
-
- count = lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL, NULL);
- g_assert(count == 500);
- lttv_traceset_context_position_save(tsc, saved_pos);
- t0 = get_time();
- count = lttv_process_traceset_seek_n_forward(tsc, 150000, NULL, NULL, NULL, NULL, NULL, NULL);
- t1 = get_time();
- g_message("Seek forward 150000 events in %g seconds", t1 - t0);
- g_assert(count == 150000);
- t0 = get_time();
- count = lttv_process_traceset_seek_n_backward(tsc, 150000,
- seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
- NULL, NULL, NULL, NULL, NULL);
- t1 = get_time();
- g_message("Seek backward 150000 events in %g seconds", t1 - t0);
- g_assert(count == 150000);
- if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
- g_warning("Problem with seek_n ! Positions differ. (1)");
- }
-
- lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL, NULL);
- lttv_traceset_context_position_save(tsc, saved_pos);
- lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL, NULL);
- lttv_process_traceset_seek_n_backward(tsc, 15005,
- seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
- NULL, NULL, NULL, NULL, NULL);
- lttv_process_traceset_seek_n_forward(tsc, 5, NULL, NULL, NULL, NULL, NULL, NULL);
- if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
- g_warning("Problem with seek_n ! Positions differ. (2)");
- }
-
- lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
-
- count = lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL, NULL);
- if(count > 0)
- g_warning("Problem with seek_n ! Forward at end of traceset.");
-
- lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
-
- lttv_traceset_context_position_save(tsc, saved_pos);
- t0 = get_time();
- lttv_process_traceset_seek_n_backward(tsc, 300,
- seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
- NULL, NULL, NULL, NULL, NULL);
- t1 = get_time();
- g_message("Seek backward 300 events in %g seconds", t1 - t0);
- count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL, NULL);
- count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL, NULL);
-
- if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
- g_warning("Problem with seek_n ! Positions differ. (4)");
- }
-
- lttv_traceset_context_position_save(tsc, saved_pos);
- t0 = get_time();
- lttv_process_traceset_seek_n_backward(tsc, 10,
- seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
- NULL, NULL, NULL, NULL, NULL);
- t1 = get_time();
- g_message("Seek backward 10 events in %g seconds", t1 - t0);
- t0 = get_time();
- count = lttv_process_traceset_seek_n_forward(tsc, 10, NULL, NULL, NULL, NULL, NULL, NULL);
- t1 = get_time();
- g_message("Seek forward 10 events in %g seconds", t1 - t0);
-
-
- /* try a volountary error */
- lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
-
- lttv_traceset_context_position_save(tsc, saved_pos);
- lttv_process_traceset_seek_n_backward(tsc, 301,
- seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
- NULL, NULL, NULL, NULL, NULL);
- count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL, NULL);
- count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL, NULL);
-
- if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) == 0) {
- g_warning("Problem with seek_n ! Positions _should_ differ. (5)");
- }
-
- /* Try a seek by closest time : Hint : try this one with and without states
- * computed. */
- lttv_process_traceset_seek_time(tsc, ltt_time_zero);
- count = lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL, NULL);
- lttv_traceset_context_position_save(tsc, saved_pos);
- t0 = get_time();
- lttv_process_traceset_seek_n_backward(tsc, 100301,
- seek_back_default_offset,
- (seek_time_fct)lttv_state_traceset_seek_time_closest, NULL,
- NULL, NULL, NULL, NULL, NULL);
- t1 = get_time();
- g_message("Seek backward 100301 events (with seek closest) in %g seconds",
- t1 - t0);
- count = lttv_process_traceset_seek_n_forward(tsc, 100301, NULL, NULL, NULL, NULL, NULL, NULL);
-
- if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
- g_warning("Problem with seek_n with state seek time! Positions differ. (6)");
- }
-
- lttv_traceset_context_position_destroy(saved_pos);
- }
-
- if(a_test10 || a_test_all) {
- g_message("Running test 10 : check seek traceset context position");
- LttvTracesetContext *tsc = &ts->parent;
- LttvTracesetContextPosition *saved_pos =
- lttv_traceset_context_position_new(tsc);
-
- lttv_process_traceset_seek_time(tsc, ltt_time_zero);
- lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL, NULL);
- lttv_traceset_context_position_save(tsc, saved_pos);
- if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) != 0)
- g_critical("Error in seek position. (1)");
-
- lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
- lttv_process_traceset_seek_n_backward(tsc, 500,
- seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
- NULL, NULL, NULL, NULL, NULL);
- lttv_traceset_context_position_save(tsc, saved_pos);
-
- if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) != 0)
- g_critical("Error in seek position. (2)");
-
- lttv_traceset_context_position_destroy(saved_pos);
- }
-
- if(a_trace_event) lttv_hooks_remove_data(event_hook, trace_event, NULL);
-
- g_free(save_state.write_time);
- g_free(a_event_position);
- lttv_context_fini(tc);
- g_object_unref(tscs);
-
- if(lttv_profile_memory) {
- g_message("Memory summary at the end of batchtest");
- g_mem_profile();
- }
-
- g_info("BatchTest end process traceset");
- return 0;
+ /* Run through all events computing the state and writing it out
+ periodically. */
+
+ SaveState save_state;
+
+ save_state.interval = a_sample_interval;
+ save_state.size = a_sample_number;
+ save_state.fp = stderr;
+ save_state.write_time = g_new(LttTime, a_sample_number);
+
+
+ if(a_test3 || a_test_all) {
+ for(i = 0 ; i < 2 ; i++) {
+ save_state.count = 0;
+ save_state.position = 0;
+ save_state.version = i;
+ lttv_state_add_event_hooks(ts);
+ lttv_hooks_add(event_hook, save_state_event, &save_state,
+ LTTV_PRIO_DEFAULT);
+ t = run_one_test(ts, ltt_time_zero, max_time);
+ lttv_state_remove_event_hooks(ts);
+ lttv_hooks_remove_data(event_hook, save_state_event, &save_state);
+ g_warning("Processing while updating/writing state (%g seconds)", t);
+ }
+ }
+
+ /* Run through all events computing the stats. */
+
+ if(a_test4 || a_test_all) {
+ if(lttv_profile_memory) {
+ g_message("Memory summary before computing stats");
+ g_mem_profile();
+ }
+
+ lttv_stats_add_event_hooks(tscs);
+ t = run_one_test(ts, ltt_time_zero, max_time);
+ lttv_stats_remove_event_hooks(tscs);
+ g_message("Processing trace while counting stats (%g seconds)", t);
+
+ if(lttv_profile_memory) {
+ g_message("Memory summary after computing stats");
+ g_mem_profile();
+ }
+
+ lttv_stats_sum_traceset(tscs, ltt_time_infinite);
+
+ if(lttv_profile_memory) {
+ g_message("Memory summary after summing stats");
+ g_mem_profile();
+ }
+
+ lttv_context_fini(tc);
+ lttv_context_init(tc, traceset);
+
+ if(lttv_profile_memory) {
+ g_message("Memory summary after cleaning up the stats");
+ g_mem_profile();
+ }
+ }
+
+ /* Run through all events computing the state and stats. */
+
+ if(a_test5 || a_test_all) {
+ if(lttv_profile_memory) {
+ g_message("Memory summary before computing state and stats");
+ g_mem_profile();
+ }
+
+ lttv_state_add_event_hooks(ts);
+ lttv_stats_add_event_hooks(tscs);
+ t = run_one_test(ts, ltt_time_zero, max_time);
+ lttv_state_remove_event_hooks(ts);
+ lttv_stats_remove_event_hooks(tscs);
+ g_message("Processing trace while counting state and stats (%g seconds)", t);
+
+ if(lttv_profile_memory) {
+ g_message("Memory summary after computing and state and stats");
+ g_mem_profile();
+ }
+
+ lttv_context_fini(tc);
+ lttv_context_init(tc, traceset);
+
+ if(lttv_profile_memory) {
+ g_message("Memory summary after cleaning up the stats");
+ g_mem_profile();
+ }
+ }
+
+ /* Run through all events computing and saving the state. */
+
+ if(a_trace_event) lttv_hooks_add(event_hook, trace_event, NULL,
+ LTTV_PRIO_DEFAULT);
+
+ if(a_test6 || a_test_all) {
+ if(lttv_profile_memory) {
+ g_message("Memory summary before computing and saving state");
+ g_mem_profile();
+ }
+
+ lttv_state_add_event_hooks(ts);
+ lttv_state_save_add_event_hooks(ts);
+ if(a_save_state_copy)
+ lttv_hooks_add(event_hook, save_state_copy_event, &save_state,
+ LTTV_PRIO_DEFAULT);
+ t = run_one_test(ts, ltt_time_zero, max_time);
+ lttv_state_remove_event_hooks(ts);
+ lttv_state_save_remove_event_hooks(ts);
+ if(a_save_state_copy)
+ lttv_hooks_remove_data(event_hook,save_state_copy_event, &save_state);
+
+ g_message("Processing trace while updating/saving state (%g seconds)", t);
+
+ if(lttv_profile_memory) {
+ g_message("Memory summary after computing/saving state");
+ g_mem_profile();
+ }
+ }
+
+ /* Seek a few times to each saved position */
+
+ if((a_test7 && a_test3) || a_test_all) {
+ g_assert(a_seek_number >= 0);
+ for(i = 0 ; i < (guint)a_seek_number ; i++) {
+ gint reverse_j; /* just to make sure j is unsigned */
+ for(reverse_j = save_state.position - 1 ; reverse_j >= 0 ; reverse_j--) {
+ j = (guint)reverse_j;
+ lttv_state_add_event_hooks(ts);
+ t = run_one_test(ts, save_state.write_time[j],
+ save_state.write_time[j]);
+ lttv_state_remove_event_hooks(ts);
+ g_message("Seeking to %lu.%lu (%g seconds)",
+ save_state.write_time[j].tv_sec,
+ save_state.write_time[j].tv_nsec, t);
+
+ if(a_save_sample != NULL) {
+ filename = g_string_new("");
+ g_string_printf(filename, "%s.%d.xml.bak%d", a_save_sample, j, i);
+ fp = fopen(filename->str, "w");
+ if(fp == NULL) g_error("Cannot open %s", filename->str);
+ g_string_free(filename, TRUE);
+ lttv_state_write((LttvTraceState *)tc->traces[0],
+ save_state.write_time[j], fp);
+ fclose(fp);
+ }
+ //else lttv_state_write((LttvTraceState *)tc->traces[0],
+ // save_state.write_time[j], save_state.fp);
+ }
+ }
+ }
+
+ /* 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_test9 || a_test_all) {
+ double t0, t1;
+ /* Run seek_forward and seek_backward test */
+ guint count;
+ LttvTracesetContext *tsc = &ts->parent;
+ LttvTracesetContextPosition *saved_pos =
+ lttv_traceset_context_position_new(tsc);
+ g_message("Running test 9 : seek_forward and seek_backward");
+ lttv_process_traceset_seek_time(tsc, ltt_time_zero);
+
+ count = lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL, NULL);
+ g_assert(count == 500);
+ lttv_traceset_context_position_save(tsc, saved_pos);
+ t0 = get_time();
+ count = lttv_process_traceset_seek_n_forward(tsc, 150000, NULL, NULL, NULL, NULL, NULL, NULL);
+ t1 = get_time();
+ g_message("Seek forward 150000 events in %g seconds", t1 - t0);
+ g_assert(count == 150000);
+ t0 = get_time();
+ count = lttv_process_traceset_seek_n_backward(tsc, 150000,
+ seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+ t1 = get_time();
+ g_message("Seek backward 150000 events in %g seconds", t1 - t0);
+ g_assert(count == 150000);
+ if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
+ g_warning("Problem with seek_n ! Positions differ. (1)");
+ }
+
+ lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL, NULL);
+ lttv_traceset_context_position_save(tsc, saved_pos);
+ lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL, NULL);
+ lttv_process_traceset_seek_n_backward(tsc, 15005,
+ seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+ lttv_process_traceset_seek_n_forward(tsc, 5, NULL, NULL, NULL, NULL, NULL, NULL);
+ if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
+ g_warning("Problem with seek_n ! Positions differ. (2)");
+ }
+
+ lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
+
+ count = lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL, NULL);
+ if(count > 0)
+ g_warning("Problem with seek_n ! Forward at end of traceset.");
+
+ lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
+
+ lttv_traceset_context_position_save(tsc, saved_pos);
+ t0 = get_time();
+ lttv_process_traceset_seek_n_backward(tsc, 300,
+ seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+ t1 = get_time();
+ g_message("Seek backward 300 events in %g seconds", t1 - t0);
+ count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL, NULL);
+ count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL, NULL);
+
+ if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
+ g_warning("Problem with seek_n ! Positions differ. (4)");
+ }
+
+ lttv_traceset_context_position_save(tsc, saved_pos);
+ t0 = get_time();
+ lttv_process_traceset_seek_n_backward(tsc, 10,
+ seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+ t1 = get_time();
+ g_message("Seek backward 10 events in %g seconds", t1 - t0);
+ t0 = get_time();
+ count = lttv_process_traceset_seek_n_forward(tsc, 10, NULL, NULL, NULL, NULL, NULL, NULL);
+ t1 = get_time();
+ g_message("Seek forward 10 events in %g seconds", t1 - t0);
+
+
+ /* try a volountary error */
+ lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
+
+ lttv_traceset_context_position_save(tsc, saved_pos);
+ lttv_process_traceset_seek_n_backward(tsc, 301,
+ seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+ count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL, NULL);
+ count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL, NULL);
+
+ if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) == 0) {
+ g_warning("Problem with seek_n ! Positions _should_ differ. (5)");
+ }
+
+ /* Try a seek by closest time : Hint : try this one with and without states
+ * computed. */
+ lttv_process_traceset_seek_time(tsc, ltt_time_zero);
+ count = lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL, NULL);
+ lttv_traceset_context_position_save(tsc, saved_pos);
+ t0 = get_time();
+ lttv_process_traceset_seek_n_backward(tsc, 100301,
+ seek_back_default_offset,
+ (seek_time_fct)lttv_state_traceset_seek_time_closest, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+ t1 = get_time();
+ g_message("Seek backward 100301 events (with seek closest) in %g seconds",
+ t1 - t0);
+ count = lttv_process_traceset_seek_n_forward(tsc, 100301, NULL, NULL, NULL, NULL, NULL, NULL);
+
+ if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
+ g_warning("Problem with seek_n with state seek time! Positions differ. (6)");
+ }
+
+ lttv_traceset_context_position_destroy(saved_pos);
+ }
+
+ if(a_test10 || a_test_all) {
+ g_message("Running test 10 : check seek traceset context position");
+ LttvTracesetContext *tsc = &ts->parent;
+ LttvTracesetContextPosition *saved_pos =
+ lttv_traceset_context_position_new(tsc);
+
+ lttv_process_traceset_seek_time(tsc, ltt_time_zero);
+ lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL, NULL);
+ lttv_traceset_context_position_save(tsc, saved_pos);
+ if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) != 0)
+ g_critical("Error in seek position. (1)");
+
+ lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
+ lttv_process_traceset_seek_n_backward(tsc, 500,
+ seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+ lttv_traceset_context_position_save(tsc, saved_pos);
+
+ if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) != 0)
+ g_critical("Error in seek position. (2)");
+
+ lttv_traceset_context_position_destroy(saved_pos);
+ }
+
+ if(a_trace_event) lttv_hooks_remove_data(event_hook, trace_event, NULL);
+
+ g_free(save_state.write_time);
+ g_free(a_event_position);
+ lttv_context_fini(tc);
+ g_object_unref(tscs);
+
+ if(lttv_profile_memory) {
+ g_message("Memory summary at the end of batchtest");
+ g_mem_profile();
+ }
+
+ g_info("BatchTest end process traceset");
+ return 0;