all the events in the main tracefile while testing the speed and
functionality of the state and stats computations. */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <string.h>
#include <lttv/lttv.h>
#include <lttv/attribute.h>
#include <lttv/hook.h>
#include <ltt/trace.h>
#include <ltt/event.h>
#include <ltt/type.h>
+#include <ltt/facility.h>
+
+#define __UNUSED__ __attribute__((__unused__))
static LttvTraceset *traceset;
} SaveState;
-static void lttv_trace_option(void *hook_data)
+static void lttv_trace_option(void __UNUSED__ *hook_data)
{
LttTrace *trace;
{
double t0, t1;
- int i;
+ unsigned int i;
//lttv_traceset_context_add_hooks(&ts->parent,
//before_traceset, after_traceset, NULL, before_trace, after_trace,
}
-gboolean trace_event(void *hook_data, void *call_data)
+gboolean trace_event(void __UNUSED__ *hook_data, void *call_data)
{
LttvTracefileState *tfs = (LttvTracefileState *)call_data;
ltt_event_position(tfs->parent.e, a_event_position);
ltt_event_position_get(a_event_position, &nb_block, &nb_event, &tf);
- fprintf(stderr,"Event %s %lu.%09lu [%lu %lu]\n",
+ fprintf(stderr,"Event %s %lu.%09lu [%u %u]\n",
ltt_eventtype_name(ltt_event_eventtype(tfs->parent.e)),
tfs->parent.timestamp.tv_sec, tfs->parent.timestamp.tv_nsec,
nb_block, nb_event);
}
-gboolean count_event(void *hook_data, void *call_data)
+gboolean count_event(void *hook_data, void __UNUSED__ *call_data)
{
guint *pcount = (guint *)hook_data;
gboolean save_state_copy_event(void *hook_data, void *call_data)
{
- SaveState *save_state = (SaveState *)hook_data;
+ SaveState __UNUSED__ *save_state = (SaveState *)hook_data;
LttvTracefileState *tfs = (LttvTracefileState *)call_data;
}
-static gboolean process_traceset(void *hook_data, void *call_data)
+static gboolean process_traceset(void __UNUSED__ *hook_data,
+ void __UNUSED__ *call_data)
{
LttvTracesetStats *tscs;
LttTracefile *tracefile, *tf;
- LttEvent *event;
+ LttEvent *event = ltt_event_new();
LttFacility *facility;
- LttType *type;
-
LttEventType *event_type;
LttTime time, previous_time;
- long long unsigned cycle_count, start_count, delta_cycle;
+ /* start_count is always initialized in this function _if_ there is always
+ * a block_start before a block_end.
+ */
+ long long unsigned cycle_count, start_count=0, delta_cycle;
long long unsigned start_nsec, end_nsec, delta_nsec, added_nsec, added_nsec2;
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);
/* Seek a few times to each saved position */
if((a_test7 && a_test3) || a_test_all) {
- int i, j;
-
- for(i = 0 ; i < a_seek_number ; i++) {
- for(j = save_state.position - 1 ; j >= 0 ; j--) {
+ 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]);
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");
}
g_info("BatchTest end process traceset");
+ return 0;
}
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);
}