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

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



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1271179116 -3600
# Node ID e2ec5cd8b3967a40c8fc83460959b5bc2b9b4ffb
# Parent  0bebb5fa4f051df9b4fed4d11a723fae91bc7523
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>
---
 tools/xentrace/xentrace.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+)

diff -r 0bebb5fa4f05 -r e2ec5cd8b396 tools/xentrace/xentrace.c
--- a/tools/xentrace/xentrace.c Tue Apr 13 15:38:27 2010 +0100
+++ b/tools/xentrace/xentrace.c Tue Apr 13 18:18: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®.