[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-4.0-testing] xentrace: Skip to low cpu when throwing away portions of the circular buffer



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1271355456 -3600
# Node ID 8fe61b0b7a2891367b09fc4a9c27b17b7f2796c3
# Parent  8a96f37e9826e8fd085fe27c04076b074a5453f1
xentrace: Skip to low cpu when throwing away portions of the circular buffer

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>
xen-unstable changeset:   21162:e2ec5cd8b396
xen-unstable date:        Tue Apr 13 18:18:36 2010 +0100
---
 tools/xentrace/xentrace.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+)

diff -r 8a96f37e9826 -r 8fe61b0b7a28 tools/xentrace/xentrace.c
--- a/tools/xentrace/xentrace.c Thu Apr 15 19:17:05 2010 +0100
+++ b/tools/xentrace/xentrace.c Thu Apr 15 19:17:36 2010 +0100
@@ -149,6 +149,7 @@ void membuf_reserve_window(unsigned cpu,
 {
     struct cpu_change_record *rec;
     long need_to_consume, free, freed;
+    int last_cpu = -1;
 
     if ( membuf.pending_size > 0 )
     {
@@ -193,10 +194,24 @@ void membuf_reserve_window(unsigned cpu,
 
         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:
     /*

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.