small fix to process_traceset middle : it won't stop if G_MAXULONG events requested
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 21 Aug 2005 04:10:43 +0000 (04:10 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 21 Aug 2005 04:10:43 +0000 (04:10 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1038 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/batchtest.c
ltt/branches/poly/lttv/lttv/hook.h
ltt/branches/poly/lttv/lttv/state.c
ltt/branches/poly/lttv/lttv/stats.c
ltt/branches/poly/lttv/lttv/tracecontext.c

index 8bb3743836959902303bb1dd9dc1a52ea3d8b4d1..7dc1771cfefc828dab813003fe26c5c4828916d0 100644 (file)
@@ -282,6 +282,7 @@ static void compute_tracefile(LttTracefile *tracefile, void *hook_data)
   
   sanitize_name(mod_name);
   
+  g_warning("test %s test", g_quark_to_string(ltt_tracefile_name(tracefile)));
   g_string_printf(filename, "%s.%s.%u.trace", a_dump_tracefiles,
       mod_name, ltt_tracefile_num(tracefile));
   fp = fopen(filename->str, "w");
@@ -310,9 +311,13 @@ static void compute_tracefile(LttTracefile *tracefile, void *hook_data)
         g_quark_to_string(ltt_tracefile_name(tracefile)));
 
     if(ltt_time_compare(time, previous_time) < 0) {
-      g_warning("Time decreasing trace %s tracefile %s position %u/%u",
+      g_warning("Time decreasing trace %s tracefile %s cpu %u position %u/%u",
     g_quark_to_string(ltt_trace_name(ltt_tracefile_get_trace(tracefile))),
-    g_quark_to_string(ltt_tracefile_name(tracefile)), nb_block, offset);
+    g_quark_to_string(ltt_tracefile_name(tracefile)), 
+    ltt_tracefile_num(tracefile), nb_block, offset);
+      g_warning("last time %lu.%lu vs current %lu.%lu",
+    previous_time.tv_sec, previous_time.tv_nsec,
+    time.tv_sec, time.tv_nsec);
     }
 
 #if 0 //FIXME
index b62ddcfc8bded1e28796d471a19292dc5f9f9772..90f50b0d54a462e99448c0879b1664a3694df552 100644 (file)
@@ -128,6 +128,9 @@ typedef struct _LttvHooksById {
   GArray *array;
 } LttvHooksById;
 
+/* macro to calculate the hook ID of a facility/event pair. */
+#define GET_HOOK_ID(fac_id, ev_id) \
+  ( (guint)fac_id | ((guint)ev_id << (8*sizeof(NUM_FACILITIES))) )
 
 /* Create and destroy a hooks by id list */
 
index 95d6a5a50df8b2397bcc5179fb2fbce22486d866..f2af9a37fa7fc76147d926ca745c643336103091 100644 (file)
@@ -968,9 +968,7 @@ static gboolean syscall_entry(void *hook_data, void *call_data)
 {
   LttvTracefileState *s = (LttvTracefileState *)call_data;
   LttEvent *e = ltt_tracefile_get_event(s->parent.tf);
-  LttvTraceHookByFacility *thf =
-        lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, 
-                                 ltt_event_facility_id(e));
+  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data;
   LttField *f = thf->f1;
 
   LttvExecutionSubmode submode;
@@ -995,9 +993,7 @@ static gboolean trap_entry(void *hook_data, void *call_data)
 {
   LttvTracefileState *s = (LttvTracefileState *)call_data;
   LttEvent *e = ltt_tracefile_get_event(s->parent.tf);
-  LttvTraceHookByFacility *thf =
-        lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, 
-                                 ltt_event_facility_id(e));
+  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data;
   LttField *f = thf->f1;
 
   LttvExecutionSubmode submode;
@@ -1024,9 +1020,7 @@ static gboolean irq_entry(void *hook_data, void *call_data)
   LttEvent *e = ltt_tracefile_get_event(s->parent.tf);
   guint8 fac_id = ltt_event_facility_id(e);
   guint8 ev_id = ltt_event_eventtype_id(e);
-  LttvTraceHookByFacility *thf =
-        lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, 
-                                 ltt_event_facility_id(e));
+  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data;
  // g_assert(lttv_trace_hook_get_first((LttvTraceHook *)hook_data)->f1 != NULL);
   g_assert(thf->f1 != NULL);
  // g_assert(thf == lttv_trace_hook_get_first((LttvTraceHook *)hook_data));
@@ -1056,9 +1050,7 @@ static gboolean schedchange(void *hook_data, void *call_data)
 {
   LttvTracefileState *s = (LttvTracefileState *)call_data;
   LttEvent *e = ltt_tracefile_get_event(s->parent.tf);
-  LttvTraceHookByFacility *thf =
-        lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, 
-                                 ltt_event_facility_id(e));
+  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data;
   guint pid_in, pid_out, state_out;
 
   pid_out = ltt_event_get_unsigned(e, thf->f1);
@@ -1104,9 +1096,7 @@ static gboolean process_fork(void *hook_data, void *call_data)
 {
   LttvTracefileState *s = (LttvTracefileState *)call_data;
   LttEvent *e = ltt_tracefile_get_event(s->parent.tf);
-  LttvTraceHookByFacility *thf =
-        lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, 
-                                 ltt_event_facility_id(e));
+  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data;
   LttField *f;
   guint parent_pid;
   guint child_pid;
@@ -1141,9 +1131,7 @@ static gboolean process_exit(void *hook_data, void *call_data)
 {
   LttvTracefileState *s = (LttvTracefileState *)call_data;
   LttEvent *e = ltt_tracefile_get_event(s->parent.tf);
-  LttvTraceHookByFacility *thf =
-        lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, 
-                                 ltt_event_facility_id(e));
+  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data;
   LttField *f;
   guint pid;
 
@@ -1162,9 +1150,7 @@ static gboolean process_free(void *hook_data, void *call_data)
 {
   LttvTracefileState *s = (LttvTracefileState *)call_data;
   LttEvent *e = ltt_tracefile_get_event(s->parent.tf);
-  LttvTraceHookByFacility *thf =
-        lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, 
-                                 ltt_event_facility_id(e));
+  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data;
   guint release_pid;
   LttvProcessState *process;
 
@@ -1298,7 +1284,7 @@ void lttv_state_add_event_hooks(LttvTracesetState *self)
           lttv_hooks_add(
             lttv_hooks_by_id_find(tfs->parent.event_by_id, thf->id),
             thf->h,
-            hook,
+            thf,
             LTTV_PRIO_STATE);
         }
       }
@@ -1358,7 +1344,7 @@ void lttv_state_remove_event_hooks(LttvTracesetState *self)
           lttv_hooks_remove_data(
             lttv_hooks_by_id_find(tfs->parent.event_by_id, thf->id),
                     thf->h,
-                    &g_array_index(hooks, LttvTraceHook, k));
+                    thf);
         }
         lttv_trace_hook_destroy(&g_array_index(hooks, LttvTraceHook, k));
       }
index d5b4f5e6ea8d5aa9856032dc074d98761d06c341..fd7b13a88db11c422307168e368ea65f2e7bb378 100644 (file)
@@ -522,9 +522,7 @@ gboolean before_schedchange(void *hook_data, void *call_data)
 
   LttEvent *e = ltt_tracefile_get_event(tfcs->parent.parent.tf);
 
-  LttvTraceHookByFacility *thf =
-        lttv_trace_hook_get_fac((LttvTraceHook *)hook_data, 
-                                 ltt_event_facility_id(e));
+  LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data;
 
   guint pid_in, pid_out, state_out;
 
@@ -902,7 +900,7 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
           lttv_hooks_add(
               lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, thf->id),
               thf->h,
-              &g_array_index(before_hooks, LttvTraceHook, k),
+              thf,
               LTTV_PRIO_STATS_BEFORE_STATE);
         }
       }
@@ -913,7 +911,7 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
           lttv_hooks_add(
               lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, thf->id),
               thf->h,
-              &g_array_index(after_hooks, LttvTraceHook, k),
+              thf,
               LTTV_PRIO_STATS_AFTER_STATE);
         }
       }
@@ -984,7 +982,7 @@ void lttv_stats_remove_event_hooks(LttvTracesetStats *self)
           lttv_hooks_remove_data(
               lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, thf->id),
               thf->h,
-              &g_array_index(before_hooks, LttvTraceHook, k));
+              thf);
         }
       }
       for(k = 0 ; k < after_hooks->len ; k++) {
@@ -994,7 +992,7 @@ void lttv_stats_remove_event_hooks(LttvTracesetStats *self)
           lttv_hooks_remove_data(
               lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, thf->id),
               thf->h,
-              &g_array_index(after_hooks, LttvTraceHook, k));
+              thf);
         }
       }
     }
index 28c279670efe89e53272cabc77bb5a378934500f..2a813151d653cfae8cc7700eaeab96e650a79a07 100644 (file)
@@ -679,7 +679,7 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self,
      */
 
     if(unlikely(last_ret == TRUE ||
-                count >= nb_events ||
+                ((count >= nb_events) && (nb_events != G_MAXULONG)) ||
      (end_position!=NULL&&lttv_traceset_context_ctx_pos_compare(self,
                                                           end_position) == 0)||
        ltt_time_compare(end, tfc->timestamp) <= 0))
@@ -844,7 +844,7 @@ lttv_trace_find_hook(LttTrace *t, GQuark facility, GQuark event,
 
   GArray *facilities;
 
-  guint i, fac_id;
+  guint i, fac_id, ev_id;
 
   LttvTraceHookByFacility *thf, *first_thf;
 
@@ -872,8 +872,10 @@ lttv_trace_find_hook(LttTrace *t, GQuark facility, GQuark event,
   g_array_index(th->fac_list, LttvTraceHookByFacility*, 0)
         = thf;
 
+  ev_id = ltt_eventtype_id(et);
+  
   thf->h = h;
-  thf->id = ltt_eventtype_id(et);
+  thf->id = GET_HOOK_ID(fac_id, ev_id);
   thf->f1 = find_field(et, field1);
   thf->f2 = find_field(et, field2);
   thf->f3 = find_field(et, field3);
@@ -891,8 +893,9 @@ lttv_trace_find_hook(LttTrace *t, GQuark facility, GQuark event,
     thf = &g_array_index(th->fac_index, LttvTraceHookByFacility, fac_id);
     g_array_index(th->fac_list, LttvTraceHookByFacility*, i)
           = thf;
+    ev_id = ltt_eventtype_id(et);
     thf->h = h;
-    thf->id = ltt_eventtype_id(et);
+    thf->id = GET_HOOK_ID(fac_id, ev_id);
     thf->f1 = find_field(et, field1);
     if(check_fields_compatibility(first_et, et,
         first_thf->f1, thf->f1))
This page took 0.030955 seconds and 4 git commands to generate.