*after_trace,
*before_tracefile,
*after_tracefile,
- *before_event,
- *after_event,
+ //*before_event,
+ //*after_event,
+ *event_hook,
*main_hooks;
static char *a_trace;
static int
a_sample_interval,
a_sample_number,
+ a_seek_number,
a_save_interval;
static gboolean
int i;
- lttv_traceset_context_add_hooks(&ts->parent,
- before_traceset, after_traceset, NULL, before_trace, after_trace,
- NULL, before_tracefile, after_tracefile, NULL, before_event, after_event);
+ //lttv_traceset_context_add_hooks(&ts->parent,
+ //before_traceset, after_traceset, NULL, before_trace, after_trace,
+ //NULL, before_tracefile, after_tracefile, NULL, before_event, after_event);
+ lttv_process_traceset_begin(&ts->parent,
+ before_traceset,
+ before_trace,
+ before_tracefile,
+ event_hook,
+ NULL);
for(i = 0 ; i < lttv_traceset_number(traceset) ; i++) {
((LttvTraceState *)(ts->parent.traces[i]))->save_interval =a_save_interval;
t0 = get_time();
lttv_state_traceset_seek_time_closest(ts, start);
- lttv_process_traceset(&ts->parent, end, G_MAXULONG);
+ //lttv_process_traceset(&ts->parent, end, G_MAXULONG);
+ lttv_process_traceset_middle(&ts->parent,
+ end,
+ G_MAXULONG,
+ NULL);
t1 = get_time();
- lttv_traceset_context_remove_hooks(&ts->parent,
- before_traceset, after_traceset, NULL, before_trace, after_trace,
- NULL, before_tracefile, after_tracefile, NULL, before_event, after_event);
+ //lttv_traceset_context_remove_hooks(&ts->parent,
+ //before_traceset, after_traceset, NULL, before_trace, after_trace,
+ //NULL, before_tracefile, after_tracefile, NULL, before_event, after_event);
+ lttv_process_traceset_end(&ts->parent,
+ after_traceset,
+ after_trace,
+ after_tracefile,
+ event_hook,
+ NULL);
return t1 - t0;
}
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);
if(a_test1 || a_test_all) {
count = 0;
- lttv_hooks_add(after_event, count_event, &count);
+ lttv_hooks_add(event_hook, count_event, &count, LTTV_PRIO_DEFAULT);
t = run_one_test(ts, zero_time, max_time);
- lttv_hooks_remove_data(after_event, count_event, &count);
+ lttv_hooks_remove_data(event_hook, count_event, &count);
g_warning(
"Processing trace while counting events (%u events in %g seconds)",
count, t);
save_state.position = 0;
save_state.version = i;
lttv_state_add_event_hooks(ts);
- lttv_hooks_add(after_event, save_state_event, &save_state);
+ lttv_hooks_add(event_hook, save_state_event, &save_state,
+ LTTV_PRIO_DEFAULT);
t = run_one_test(ts, zero_time, max_time);
lttv_state_remove_event_hooks(ts);
- lttv_hooks_remove_data(after_event, save_state_event, &save_state);
+ 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 and saving the state. */
- if(a_trace_event) lttv_hooks_add(after_event, trace_event, NULL);
+ 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) {
lttv_state_add_event_hooks(ts);
lttv_state_save_add_event_hooks(ts);
if(a_save_state_copy)
- lttv_hooks_add(after_event, save_state_copy_event, &save_state);
+ lttv_hooks_add(event_hook, save_state_copy_event, &save_state,
+ LTTV_PRIO_DEFAULT);
t = run_one_test(ts, zero_time, max_time);
lttv_state_remove_event_hooks(ts);
lttv_state_save_remove_event_hooks(ts);
if(a_save_state_copy)
- lttv_hooks_remove_data(after_event,save_state_copy_event, &save_state);
+ lttv_hooks_remove_data(event_hook,save_state_copy_event, &save_state);
g_warning("Processing trace while updating/saving state (%g seconds)", t);
if((a_test7 && a_test3) || a_test_all) {
int i, j;
- for(i = 0 ; i < 2 ; i++) {
+ for(i = 0 ; i < a_seek_number ; i++) {
for(j = save_state.position - 1 ; j >= 0 ; j--) {
lttv_state_add_event_hooks(ts);
t = run_one_test(ts, save_state.write_time[j],
}
}
- if(a_trace_event) lttv_hooks_remove_data(after_event, trace_event, NULL);
+ 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);
+ ltt_event_destroy(event);
if(lttv_profile_memory) {
g_message("Memory summary at the end of batchtest");
"maximum number",
LTTV_OPT_INT, &a_sample_number, NULL, NULL);
+ a_seek_number = 200;
+ lttv_option_add("seek-number", 'K',
+ "Number of seek",
+ "number",
+ LTTV_OPT_INT, &a_seek_number, NULL, NULL);
+
a_test1 = FALSE;
lttv_option_add("test1", '1', "Test just counting events", "",
LTTV_OPT_NONE, &a_test1, NULL, NULL);
after_trace = lttv_hooks_new();
before_tracefile = lttv_hooks_new();
after_tracefile = lttv_hooks_new();
- before_event = lttv_hooks_new();
- after_event = lttv_hooks_new();
+ //before_event = lttv_hooks_new();
+ //after_event = lttv_hooks_new();
+ event_hook = lttv_hooks_new();
+
g_assert(lttv_iattribute_find_by_path(attributes, "hooks/traceset/before",
LTTV_POINTER, &value));
g_assert(lttv_iattribute_find_by_path(attributes, "hooks/tracefile/after",
LTTV_POINTER, &value));
*(value.v_pointer) = after_tracefile;
- g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/before",
+ //g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/before",
+ // LTTV_POINTER, &value));
+ //*(value.v_pointer) = before_event;
+ //g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/after",
+ // LTTV_POINTER, &value));
+ //*(value.v_pointer) = after_event;
+ g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event",
LTTV_POINTER, &value));
- *(value.v_pointer) = before_event;
- g_assert(lttv_iattribute_find_by_path(attributes, "hooks/event/after",
- LTTV_POINTER, &value));
- *(value.v_pointer) = after_event;
-
+ *(value.v_pointer) = event_hook;
g_assert(lttv_iattribute_find_by_path(attributes, "hooks/main/before",
LTTV_POINTER, &value));
g_assert((main_hooks = *(value.v_pointer)) != NULL);
- lttv_hooks_add(main_hooks, process_traceset, NULL);
+ lttv_hooks_add(main_hooks, process_traceset, NULL, LTTV_PRIO_DEFAULT);
}
lttv_option_remove("save-state-copy");
lttv_option_remove("sample-interval");
lttv_option_remove("sample-number");
+ lttv_option_remove("seek-number");
lttv_option_remove("save-interval");
lttv_option_remove("test1");
lttv_option_remove("test2");
lttv_hooks_destroy(after_trace);
lttv_hooks_destroy(before_tracefile);
lttv_hooks_destroy(after_tracefile);
- lttv_hooks_destroy(before_event);
- lttv_hooks_destroy(after_event);
+ //lttv_hooks_destroy(before_event);
+ //lttv_hooks_destroy(after_event);
+ lttv_hooks_destroy(event_hook);
lttv_hooks_remove_data(main_hooks, process_traceset, NULL);
nb = lttv_traceset_number(traceset);
for(i = 0 ; i < nb ; i++) {
trace = lttv_traceset_get(traceset, i);
+ lttv_traceset_remove(traceset,i);
ltt_trace_close(lttv_trace(trace));
lttv_trace_destroy(trace);
}