aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xentrace/xentrace_format
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-11-18 17:54:23 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-11-18 17:54:23 +0100
commit1f39a6dc5e1dc869fc25c40142c65e948f5ad13c (patch)
tree590d56bf815a988315388bb7f18af1049e39a277 /tools/xentrace/xentrace_format
parent931a2bf97fa446879e3df8d8cd679a3d652ee707 (diff)
downloadxen-1f39a6dc5e1dc869fc25c40142c65e948f5ad13c.tar.gz
xen-1f39a6dc5e1dc869fc25c40142c65e948f5ad13c.tar.bz2
xen-1f39a6dc5e1dc869fc25c40142c65e948f5ad13c.zip
The xentrace_format script doesn't work on x86/64. Python pads the input
structure because the first field is 32 bits and the next is 64 bits, whereas x86-32 doesn't pad. The quick fix is to read the cpu id separately as a 32bit value, then read the rest of the trace record. Here is a little patch that does that. Tested on x86/32 SMP and x86/64. Signed-off-by: Rob Gardner <rob.gardner@hp.com>
Diffstat (limited to 'tools/xentrace/xentrace_format')
-rw-r--r--tools/xentrace/xentrace_format11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/xentrace/xentrace_format b/tools/xentrace/xentrace_format
index 82b406afe6..827680b95e 100644
--- a/tools/xentrace/xentrace_format
+++ b/tools/xentrace/xentrace_format
@@ -85,7 +85,9 @@ defs = read_defs(arg[0])
# structure of trace record + prepended CPU id (as output by xentrace):
# CPU(I) TSC(Q) EVENT(L) D1(L) D2(L) D3(L) D4(L) D5(L)
-TRCREC = "IQLLLLLL"
+# read CPU id separately to avoid structure packing problems on 64-bit arch.
+CPUREC = "I"
+TRCREC = "QLLLLLL"
last_tsc = [0,0,0,0,0,0,0,0]
@@ -94,11 +96,16 @@ i=0
while not interrupted:
try:
i=i+1
+ line = sys.stdin.read(struct.calcsize(CPUREC))
+ if not line:
+ break
+ cpu = struct.unpack(CPUREC, line)[0]
+
line = sys.stdin.read(struct.calcsize(TRCREC))
if not line:
break
- (cpu, tsc, event, d1, d2, d3, d4, d5) = struct.unpack(TRCREC, line)
+ (tsc, event, d1, d2, d3, d4, d5) = struct.unpack(TRCREC, line)
#tsc = (tscH<<32) | tscL