WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 1 of 3] xentrace: Skip to low cpu when throwing away

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 1 of 3] xentrace: Skip to low cpu when throwing away portions of the circular buffer
From: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Date: Tue, 13 Apr 2010 17:52:58 +0100
Cc: george.dunlap@xxxxxxxxxxxxx
Delivery-date: Tue, 13 Apr 2010 09:57:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1271177577@silas>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1271177577@silas>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Skip to the next "low" cpu when throwing away portions of the circular
memory buffer.  This makes subsequent analysis easier.

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

diff -r 859a372efa66 -r 16ef34de0129 tools/xentrace/xentrace.c
--- a/tools/xentrace/xentrace.c Tue Apr 13 13:40:58 2010 +0100
+++ b/tools/xentrace/xentrace.c Tue Apr 13 17:24:07 2010 +0100
@@ -149,6 +149,7 @@
 {
     struct cpu_change_record *rec;
     long need_to_consume, free, freed;
+    int last_cpu = -1;
 
     if ( membuf.pending_size > 0 )
     {
@@ -193,11 +194,25 @@
 
         if ( need_to_consume > 0 )
         {
+            last_cpu = rec->data.cpu;
             MEMBUF_CONS_INCREMENT(freed);
             need_to_consume -= freed;
         }
     } while( need_to_consume > 0 );
 
+    /* For good tsc consistency, we need to start at a low-cpu buffer.  Keep
+     * skipping until the cpu goes down or stays the same. */
+    rec = (struct cpu_change_record *)MEMBUF_POINTER(membuf.cons);
+    while ( rec->data.cpu > last_cpu )
+    {
+        last_cpu = rec->data.cpu; 
+
+        freed = sizeof(*rec) + rec->data.window_size;
+        
+        MEMBUF_CONS_INCREMENT(freed);
+        rec = (struct cpu_change_record *)MEMBUF_POINTER(membuf.cons);
+    }
+
 start_window:
     /*
      * Start writing "pending" data.  Update prod once all this data is

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>