ia64/xen-unstable

changeset 7909:378e1c58bcd2

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>
author kaf24@firebug.cl.cam.ac.uk
date Fri Nov 18 17:54:23 2005 +0100 (2005-11-18)
parents 0970a2fdbee9
children 56d05708736a
files tools/xentrace/xentrace_format
line diff
     1.1 --- a/tools/xentrace/xentrace_format	Fri Nov 18 17:50:25 2005 +0100
     1.2 +++ b/tools/xentrace/xentrace_format	Fri Nov 18 17:54:23 2005 +0100
     1.3 @@ -85,7 +85,9 @@ defs = read_defs(arg[0])
     1.4  
     1.5  # structure of trace record + prepended CPU id (as output by xentrace):
     1.6  # CPU(I) TSC(Q) EVENT(L) D1(L) D2(L) D3(L) D4(L) D5(L)
     1.7 -TRCREC = "IQLLLLLL"
     1.8 +# read CPU id separately to avoid structure packing problems on 64-bit arch.
     1.9 +CPUREC = "I"
    1.10 +TRCREC = "QLLLLLL"
    1.11  
    1.12  last_tsc = [0,0,0,0,0,0,0,0]
    1.13  
    1.14 @@ -94,11 +96,16 @@ i=0
    1.15  while not interrupted:
    1.16      try:
    1.17  	i=i+1
    1.18 +        line = sys.stdin.read(struct.calcsize(CPUREC))
    1.19 +        if not line:
    1.20 +            break
    1.21 +        cpu = struct.unpack(CPUREC, line)[0]
    1.22 +
    1.23          line = sys.stdin.read(struct.calcsize(TRCREC))
    1.24          if not line:
    1.25              break
    1.26  
    1.27 -        (cpu, tsc, event, d1, d2, d3, d4, d5) = struct.unpack(TRCREC, line)
    1.28 +        (tsc, event, d1, d2, d3, d4, d5) = struct.unpack(TRCREC, line)
    1.29  
    1.30  	#tsc = (tscH<<32) | tscL
    1.31