lttv_process_trace function takes another parameters: maxNumEvents
authoryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 11 Sep 2003 15:54:36 +0000 (15:54 +0000)
committeryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 11 Sep 2003 15:54:36 +0000 (15:54 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@232 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/batchAnalysis.c
ltt/branches/poly/lttv/processTrace.c

index 0f169c717603ecadad8152e67381910230b14f0c..a8d1c824f98d2a5341eafdbb4f0d67e9d151c9f3 100644 (file)
@@ -55,7 +55,7 @@ static gboolean process_traceset(void *hook_data, void *call_data)
   end.tv_sec = G_MAXULONG;
   end.tv_nsec = G_MAXULONG;
 
-  lttv_process_trace(start, end, traceset, LTTV_TRACESET_CONTEXT(tc));
+  lttv_process_trace(start, end, traceset, LTTV_TRACESET_CONTEXT(tc),G_MAXULONG);
   lttv_traceset_context_remove_hooks(LTTV_TRACESET_CONTEXT(tc),
   before_traceset, after_traceset, NULL, before_trace, after_trace,
   NULL, before_tracefile, after_tracefile, NULL, before_event, after_event);
index 550b9c4295d694bda999f5bde4ea8d4ef2b0b7d8..122ce5109b14c5f3c0f5bba9886bcb46115b7c03 100644 (file)
@@ -441,7 +441,7 @@ gboolean get_first(gpointer key, gpointer value, gpointer user_data) {
 
 
 void lttv_process_trace(LttTime start, LttTime end, LttvTraceset *traceset, 
-    LttvTracesetContext *context)
+    LttvTracesetContext *context, unsigned maxNumEvents)
 {
   GPtrArray *traces = g_ptr_array_new();
 
@@ -460,6 +460,8 @@ void lttv_process_trace(LttTime start, LttTime end, LttvTraceset *traceset,
   LttvTracefileContext *tfc;
 
   LttEvent *event;
+  unsigned count = 0;
+  LttTime preTimestamp;
 
   /* Call all before_traceset, before_trace, and before_tracefile hooks.
      For all qualifying tracefiles, seek to the start time, create a context,
@@ -521,6 +523,23 @@ void lttv_process_trace(LttTime start, LttTime end, LttvTraceset *traceset,
        or more tracefiles have events for the same time, hope that lookup
        and remove are consistent. */
 
+    count++;
+    if(count > maxNumEvents){
+      if(tfc->timestamp.tv_sec == preTimestamp.tv_sec &&
+        tfc->timestamp.tv_nsec == preTimestamp.tv_nsec) {
+       count--;
+      }else{   
+       while(TRUE){
+         tfc = NULL;
+         g_tree_foreach(pqueue, get_first, &tfc);
+         if(tfc == NULL) break;
+         g_tree_remove(pqueue, &(tfc->timestamp));
+       }
+       break;
+      }
+    }
+    preTimestamp = tfc->timestamp;
+
     tfc = g_tree_lookup(pqueue, &(tfc->timestamp));
     g_tree_remove(pqueue, &(tfc->timestamp));
 
@@ -536,7 +555,9 @@ void lttv_process_trace(LttTime start, LttTime end, LttvTraceset *traceset,
     if(event != NULL) {
       tfc->e = event;
       tfc->timestamp = ltt_event_time(event);
-      g_tree_insert(pqueue, &(tfc->timestamp), tfc);
+      if(tfc->timestamp.tv_sec < end.tv_sec ||
+        (tfc->timestamp.tv_sec == end.tv_sec && tfc->timestamp.tv_nsec <= end.tv_nsec))
+       g_tree_insert(pqueue, &(tfc->timestamp), tfc);
     }
   }
 
This page took 0.025803 seconds and 4 git commands to generate.