minor modifications to batchtest
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 26 May 2004 20:59:17 +0000 (20:59 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 26 May 2004 20:59:17 +0000 (20:59 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@560 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/batchtest.c
ltt/branches/poly/lttv/lttv/tracecontext.c
ltt/branches/poly/lttv/lttv/tracecontext.h

index 598eb7fd4efc61700bfd4de9246601796508b1a3..ec9472545cfb58be8b0d13804d17a5fa12023a11 100644 (file)
@@ -42,8 +42,9 @@ static LttvHooks
   *after_trace,
   *before_tracefile,
   *after_tracefile,
-  *before_event,
-  *after_event,
+  //*before_event,
+  //*after_event,
+  *event_hook,
   *main_hooks;
 
 static char *a_trace;
@@ -106,9 +107,15 @@ static double run_one_test(LttvTracesetState *ts, LttTime start, LttTime end)
 
   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;
@@ -116,12 +123,22 @@ static double run_one_test(LttvTracesetState *ts, LttTime start, LttTime end)
 
   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;
 }
@@ -348,9 +365,9 @@ static gboolean process_traceset(void *hook_data, void *call_data)
 
   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);
@@ -382,10 +399,11 @@ static gboolean process_traceset(void *hook_data, void *call_data)
       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);
     }
   }
@@ -456,7 +474,8 @@ static gboolean process_traceset(void *hook_data, void *call_data)
 
   /* 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) {
@@ -467,12 +486,13 @@ static gboolean process_traceset(void *hook_data, void *call_data)
     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);
 
@@ -513,7 +533,7 @@ static gboolean process_traceset(void *hook_data, void *call_data)
     }
   }
 
-  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);
@@ -624,8 +644,10 @@ static void init()
   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));
@@ -645,17 +667,19 @@ static void init()
   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/event_hook",
       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);
 }
 
 
@@ -690,8 +714,9 @@ static void destroy()
   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);
index 395b3ab2c2e9334c1b6e49af730553de74c29696..b66f44f5340c46a0c0254c9a65ac75e45bda6cb1 100644 (file)
@@ -598,7 +598,7 @@ void lttv_process_traceset_begin(LttvTracesetContext *self,
 /* Note : a _middle must be preceded from a _seek or another middle */
 guint lttv_process_traceset_middle(LttvTracesetContext *self,
                               LttTime end,
-                              unsigned nb_events,
+                              guint nb_events,
                               const LttvTracesetContextPosition *end_position)
 {
   GTree *pqueue = self->pqueue;
index 6bda5fc2371553e76a0d1e78b9ae8a64fd29ea7b..d50c8b56afbcf8588fa1e5f3a8f8f423ed24d35a 100644 (file)
@@ -196,7 +196,7 @@ void lttv_process_traceset_begin(LttvTracesetContext *self,
 
 guint lttv_process_traceset_middle(LttvTracesetContext *self,
                               LttTime end, 
-                              unsigned nb_events,
+                              guint nb_events,
                               const LttvTracesetContextPosition *end_position);
 
 void lttv_process_traceset_end(LttvTracesetContext *self,
This page took 0.02637 seconds and 4 git commands to generate.