aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xentrace
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-04-13 18:18:36 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-04-13 18:18:36 +0100
commit778757601420fe15afa7eb774dbfb143f2d78a4e (patch)
treecbc8b479ab22c03eed8094d53d2a63e232ee1b18 /tools/xentrace
parent70121cba8fd66557f88b4dc685c3fcbc4d9a44aa (diff)
downloadxen-778757601420fe15afa7eb774dbfb143f2d78a4e.tar.gz
xen-778757601420fe15afa7eb774dbfb143f2d78a4e.tar.bz2
xen-778757601420fe15afa7eb774dbfb143f2d78a4e.zip
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@eu.citrix.com>
Diffstat (limited to 'tools/xentrace')
-rw-r--r--tools/xentrace/xentrace.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index 18283f3e97..cce5469c47 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -149,6 +149,7 @@ void membuf_reserve_window(unsigned cpu, unsigned long window_size)
{
struct cpu_change_record *rec;
long need_to_consume, free, freed;
+ int last_cpu = -1;
if ( membuf.pending_size > 0 )
{
@@ -193,11 +194,25 @@ void membuf_reserve_window(unsigned cpu, unsigned long window_size)
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