ia64/xen-unstable

changeset 1166:aa95cfec4242

bitkeeper revision 1.784 (4050c414tIvxGfQ8IUNIXoAjpoXBVA)

Updated script names and added man pages for all the xentrace tools.
author mwilli2@equilibrium.research.intel-research.net
date Thu Mar 11 19:55:00 2004 +0000 (2004-03-11)
parents c4aa70095bed
children 9f76e6bae78e
files .rootkeys docs/interface.tex tools/xentrace/Makefile tools/xentrace/xentrace.8 tools/xentrace/xentrace_cpusplit tools/xentrace/xentrace_cpusplit.1 tools/xentrace/xentrace_cpusplit.py tools/xentrace/xentrace_format tools/xentrace/xentrace_format.1 tools/xentrace/xentrace_format.py
line diff
     1.1 --- a/.rootkeys	Thu Mar 11 17:26:10 2004 +0000
     1.2 +++ b/.rootkeys	Thu Mar 11 19:55:00 2004 +0000
     1.3 @@ -90,9 +90,12 @@ 3fbd0a40yT6G3M9hMpaz5xTUdl0E4g tools/xc/
     1.4  40431ac64Hj4ixUnKmlugZKhXPFE_Q tools/xend/Makefile
     1.5  40431ac8wrUEj-XM7B8smFtx_HA7lQ tools/xend/xend_utils.c
     1.6  403a3edbrr8RE34gkbR40zep98SXbg tools/xentrace/Makefile
     1.7 +4050c413PhhLNAYk3TEwP37i_iLw9Q tools/xentrace/xentrace.8
     1.8  403a3edbVpV2E_wq1zeEkJ_n4Uu2eg tools/xentrace/xentrace.c
     1.9 -403a3edb0lzD0Fojc-NYNoXr3SYrnA tools/xentrace/xentrace_cpusplit.py
    1.10 -403a3edblCUrzSj0mmKhO5HOPrOrSQ tools/xentrace/xentrace_format.py
    1.11 +403a3edb0lzD0Fojc-NYNoXr3SYrnA tools/xentrace/xentrace_cpusplit
    1.12 +4050c413BnzzZZlZRI1ai6oFXOsHLQ tools/xentrace/xentrace_cpusplit.1
    1.13 +403a3edblCUrzSj0mmKhO5HOPrOrSQ tools/xentrace/xentrace_format
    1.14 +4050c413NtuyIq5lsYJV4P7KIjujXw tools/xentrace/xentrace_format.1
    1.15  3f72f1bdJPsV3JCnBqs9ddL9tr6D2g xen/COPYING
    1.16  3ddb79bcbOVHh38VJzc97-JEGD4dJQ xen/Makefile
    1.17  3ddb79bcWnTwYsQRWl_PaneJfa6p0w xen/Rules.mk
     2.1 --- a/docs/interface.tex	Thu Mar 11 17:26:10 2004 +0000
     2.2 +++ b/docs/interface.tex	Thu Mar 11 19:55:00 2004 +0000
     2.3 @@ -432,10 +432,11 @@ for machines with multiple (logical) CPU
     2.4  in overall chronological order.
     2.5  
     2.6  The output from {\tt xentrace} can be post-processed using {\tt
     2.7 -xentrace\_split.py} (used to split trace data out into per-cpu log files) and
     2.8 -{\tt xentrace\_format.py} (used to pretty-print trace data).
     2.9 +xentrace\_cpusplit} (used to split trace data out into per-cpu log files) and
    2.10 +{\tt xentrace\_format} (used to pretty-print trace data).
    2.11  
    2.12 -For more information, see the {\tt xentrace} manual page.
    2.13 +For more information, see the manual pages for {\tt xentrace},
    2.14 +{\tt xentrace_format} and {\tt xentrace_cpusplit}.
    2.15  
    2.16  
    2.17  \chapter{Hypervisor calls}
     3.1 --- a/tools/xentrace/Makefile	Thu Mar 11 17:26:10 2004 +0000
     3.2 +++ b/tools/xentrace/Makefile	Thu Mar 11 19:55:00 2004 +0000
     3.3 @@ -7,17 +7,18 @@ CFLAGS  += -I../../xenolinux-sparse/incl
     3.4  HDRS     = $(wildcard *.h)
     3.5  OBJS     = $(patsubst %.c,%.o,$(wildcard *.c))
     3.6  
     3.7 -BIN      = xentrace
     3.8 -SCRIPTS  = $(wildcard *.py)
     3.9 +BIN      = xentrace xentrace_cpusplit xentrace_format
    3.10 +MAN1     = $(wildcard *.1)
    3.11 +MAN8     = $(wildcard *.8)
    3.12  
    3.13  all: $(BIN)
    3.14  
    3.15  install: all
    3.16  	mkdir -p /usr/bin
    3.17  	cp $(BIN) /usr/bin
    3.18 -	cp $(SCRIPTS) /usr/bin
    3.19 -	chmod 755 /usr/bin/$(BIN)
    3.20 -	for i in $(SCRIPTS); do chmod 755 /usr/bin/$$i; done
    3.21 +	for i in $(BIN); do chmod 755 /usr/bin/$$i; done
    3.22 +	for i in $(MAN1); do cp $$i /usr/man/man1/$$i; done
    3.23 +	for i in $(MAN8); do cp $$i /usr/man/man8/$$i; done
    3.24  
    3.25  dist: all
    3.26  	mkdir -p ../../../install/bin
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/xentrace/xentrace.8	Thu Mar 11 19:55:00 2004 +0000
     4.3 @@ -0,0 +1,38 @@
     4.4 +.TH XENTRACE 8 "11 March 2004" "Xen domain 0 utils"
     4.5 +.SH NAME
     4.6 +xentrace \- capture Xen trace buffer data
     4.7 +.SH SYNOPSIS
     4.8 +.B xentrace
     4.9 +[
    4.10 +.I OPTIONS
    4.11 +] [
    4.12 +.I FILE
    4.13 +]
    4.14 +.SH DESCRIPTION
    4.15 +.B xentrace
    4.16 +is used to dump data from Xen's per-cpu trace buffers.  Records
    4.17 +are dumped in ASCII format, onto the standard output or a \fIFILE\fP
    4.18 +specified on the command line.
    4.19 +Trace records are formatted as follows:
    4.20 +.PP
    4.21 +                    CPU TSC EVENT D1 D2 D3 D4 D5
    4.22 +.PP
    4.23 +Where CPU is the processor number, TSC is the record's timestamp
    4.24 +(the value of the CPU cycle counter), EVENT is the event ID and
    4.25 +D1...D5 are the trace data.
    4.26 +
    4.27 +.SS Options
    4.28 +.TP
    4.29 +.B -t, --log-thresh=l
    4.30 +set the threshold number, l, of new records required to trigger a write of
    4.31 +all new records to the output
    4.32 +.TP
    4.33 +.B -s, --poll-sleep=p
    4.34 +set the time, p, (in milliseconds) to sleep between polling the buffers
    4.35 +for new data.
    4.36 +
    4.37 +.SH AUTHOR
    4.38 +Mark A. Williamson <mark.a.williamson@intel.com>
    4.39 +
    4.40 +.SH "SEE ALSO"
    4.41 +xentrace_cpuinfo(1), xentrace_format(1)
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/tools/xentrace/xentrace_cpusplit	Thu Mar 11 19:55:00 2004 +0000
     5.3 @@ -0,0 +1,59 @@
     5.4 +#!/usr/bin/env python
     5.5 +
     5.6 +# by Mark Williamson, (C) 2004 Intel Research Cambridge
     5.7 +
     5.8 +# Program for separating trace buffer data into per-cpu log files.
     5.9 +
    5.10 +import re, sys, signal
    5.11 +
    5.12 +def usage():
    5.13 +    print >> sys.stderr, \
    5.14 +          "Usage: " + sys.argv[0] + """ base-name
    5.15 +          Separates ASCII trace buffer data on stdin into per-CPU trace
    5.16 +          files.  The trace files are named by appending the CPU number
    5.17 +          to the base name supplied on the command line.
    5.18 +
    5.19 +          Depending on your system and the volume of trace buffer data,
    5.20 +          this script may not be able to keep up with the output of xentrace
    5.21 +          if it is piped directly.  In these circumstances you should have
    5.22 +          xentrace output to a file for processing off-line.
    5.23 +          """
    5.24 +    sys.exit(1)
    5.25 +    
    5.26 +def sighand(x,y):
    5.27 +    global interrupted
    5.28 +    interrupted = 1
    5.29 +
    5.30 +signal.signal(signal.SIGTERM, sighand)
    5.31 +signal.signal(signal.SIGHUP,  sighand)
    5.32 +signal.signal(signal.SIGINT,  sighand)
    5.33 +
    5.34 +r = re.compile("(\d) .*")
    5.35 +
    5.36 +if len(sys.argv) < 2:
    5.37 +    usage()
    5.38 +else:
    5.39 +    base_name = sys.argv[1]
    5.40 +
    5.41 +files = {}
    5.42 +interrupted = 0
    5.43 +
    5.44 +while not interrupted:
    5.45 +    try:
    5.46 +        line = sys.stdin.readline()
    5.47 +        if not line: break
    5.48 +        
    5.49 +        m = r.match(line)
    5.50 +
    5.51 +        if not m: print >> sys.stderr, "Invalid input line."
    5.52 +        
    5.53 +        cpu = m.group(1)
    5.54 +        
    5.55 +        if not files.has_key(base_name + str(cpu)):
    5.56 +            files[base_name + str(cpu)] = open(base_name + str(cpu), "w")
    5.57 +            
    5.58 +        print >> files[base_name + str(cpu)], line,
    5.59 +
    5.60 +    except IOError: sys.exit()
    5.61 +
    5.62 +# files closed automatically
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/tools/xentrace/xentrace_cpusplit.1	Thu Mar 11 19:55:00 2004 +0000
     6.3 @@ -0,0 +1,27 @@
     6.4 +.TH XENTRACE_CPUSPLIT 1 "11 March 2004" "Xen domain 0 utils"
     6.5 +.SH NAME
     6.6 +xentrace_cpusplit \- separate Xen trace data into per-CPU log files
     6.7 +.SH SYNOPSIS
     6.8 +.B xentrace_cpusplit
     6.9 +[
    6.10 +.I BASE-NAME
    6.11 +]
    6.12 +.SH DESCRIPTION
    6.13 +.B xentrace_cpusplit
    6.14 +Separates ASCII trace buffer data from stdin into per-CPU trace
    6.15 +files.  The trace files are named by appending the CPU number
    6.16 +to the \fIBASE-NAME\fP supplied on the command line.
    6.17 +
    6.18 +The trace records in the per-CPU files are in identical format to the
    6.19 +original output of \fBxentrace\fP and are in chronological order.
    6.20 +
    6.21 +Depending on your system and the rate at which trace data is produced,
    6.22 +this script may not be able to keep up with the output of
    6.23 +\fBxentrace\fP if it is piped directly.  In these circumstances you
    6.24 +should have \fBxentrace\fP output to a file for processing off-line.
    6.25 +
    6.26 +.SH AUTHOR
    6.27 +Mark A. Williamson <mark.a.williamson@intel.com>
    6.28 +
    6.29 +.SH "SEE ALSO"
    6.30 +xentrace(8), xentrace_format(1)
     7.1 --- a/tools/xentrace/xentrace_cpusplit.py	Thu Mar 11 17:26:10 2004 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,59 +0,0 @@
     7.4 -#!/usr/bin/env python
     7.5 -
     7.6 -# by Mark Williamson, (C) 2004 Intel Research Cambridge
     7.7 -
     7.8 -# Program for separating trace buffer data into per-cpu log files.
     7.9 -
    7.10 -import re, sys, signal
    7.11 -
    7.12 -def usage():
    7.13 -    print >> sys.stderr, \
    7.14 -          "Usage: " + sys.argv[0] + """ base-name
    7.15 -          Separates ASCII trace buffer data on stdin into per-CPU trace
    7.16 -          files.  The trace files are named by appending the CPU number
    7.17 -          to the base name supplied on the command line.
    7.18 -
    7.19 -          Depending on your system and the volume of trace buffer data,
    7.20 -          this script may not be able to keep up with the output of xentrace
    7.21 -          if it is piped directly.  In these circumstances you should have
    7.22 -          xentrace output to a file for processing off-line.
    7.23 -          """
    7.24 -    sys.exit(1)
    7.25 -    
    7.26 -def sighand(x,y):
    7.27 -    global interrupted
    7.28 -    interrupted = 1
    7.29 -
    7.30 -signal.signal(signal.SIGTERM, sighand)
    7.31 -signal.signal(signal.SIGHUP,  sighand)
    7.32 -signal.signal(signal.SIGINT,  sighand)
    7.33 -
    7.34 -r = re.compile("(\d) .*")
    7.35 -
    7.36 -if len(sys.argv) < 2:
    7.37 -    usage()
    7.38 -else:
    7.39 -    base_name = sys.argv[1]
    7.40 -
    7.41 -files = {}
    7.42 -interrupted = 0
    7.43 -
    7.44 -while not interrupted:
    7.45 -    try:
    7.46 -        line = sys.stdin.readline()
    7.47 -        if not line: break
    7.48 -        
    7.49 -        m = r.match(line)
    7.50 -
    7.51 -        if not m: print >> sys.stderr, "Invalid input line."
    7.52 -        
    7.53 -        cpu = m.group(1)
    7.54 -        
    7.55 -        if not files.has_key(base_name + str(cpu)):
    7.56 -            files[base_name + str(cpu)] = open(base_name + str(cpu), "w")
    7.57 -            
    7.58 -        print >> files[base_name + str(cpu)], line,
    7.59 -
    7.60 -    except IOError: sys.exit()
    7.61 -
    7.62 -# files closed automatically
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/tools/xentrace/xentrace_format	Thu Mar 11 19:55:00 2004 +0000
     8.3 @@ -0,0 +1,96 @@
     8.4 +#!/usr/bin/env python
     8.5 +
     8.6 +# by Mark Williamson, (C) 2004 Intel Research Cambridge
     8.7 +
     8.8 +# Program for reformatting trace buffer output according to user-supplied rules
     8.9 +
    8.10 +import re, sys, string, signal
    8.11 +
    8.12 +def usage():
    8.13 +    print >> sys.stderr, \
    8.14 +          "Usage: " + sys.argv[0] + """ defs-file
    8.15 +          Parses trace data in ASCII format and reformats it according to the
    8.16 +          rules in a file of definitions.  The rules in this file should have
    8.17 +          the format ({ and } show grouping and are not part of the syntax):
    8.18 +
    8.19 +          {event_id}{whitespace}{text format string}
    8.20 +
    8.21 +          The textual format string may include the format specifiers:
    8.22 +            %(cpu)s, %(tsc), %(event)s, %(1)s, %(2)s, %(3)s, %(4)s, %(5)s
    8.23 +
    8.24 +          Which correspond to the CPU number, event ID, timestamp counter and
    8.25 +          the 5 data fields from the trace record.  There should be one such
    8.26 +          rule for each type of event.
    8.27 +          
    8.28 +          Depending on your system and the volume of trace buffer data,
    8.29 +          this script may not be able to keep up with the output of xentrace
    8.30 +          if it is piped directly.  In these circumstances you should have
    8.31 +          xentrace output to a file for processing off-line.
    8.32 +          """
    8.33 +    sys.exit(1)
    8.34 +
    8.35 +def read_defs(defs_file):
    8.36 +    defs = {}
    8.37 +    
    8.38 +    fd = open(defs_file)
    8.39 +
    8.40 +    reg = re.compile('(\d+)\s+(\S.*)')
    8.41 +
    8.42 +    while True:
    8.43 +        line = fd.readline()
    8.44 +        if not line:
    8.45 +            break
    8.46 +        
    8.47 +        m = reg.match(line)
    8.48 +
    8.49 +        if not m: print >> sys.stderr, "Bad format file" ; sys.exit(1)
    8.50 +        
    8.51 +        defs[m.group(1)] = m.group(2)
    8.52 +
    8.53 +    return defs
    8.54 +
    8.55 +def sighand(x,y):
    8.56 +    global interrupted
    8.57 +    interrupted = 1
    8.58 +
    8.59 +##### Main code
    8.60 +
    8.61 +if len(sys.argv) < 2:
    8.62 +    usage()
    8.63 +
    8.64 +signal.signal(signal.SIGTERM, sighand)
    8.65 +signal.signal(signal.SIGHUP,  sighand)
    8.66 +signal.signal(signal.SIGINT,  sighand)
    8.67 +
    8.68 +interrupted = 0
    8.69 +
    8.70 +defs = read_defs(sys.argv[1])
    8.71 +
    8.72 +reg = re.compile('(\d+) (\d+) (\d+) (.*)')
    8.73 +
    8.74 +while not interrupted:
    8.75 +    try:
    8.76 +        line = sys.stdin.readline()
    8.77 +        if not line:
    8.78 +            break
    8.79 +
    8.80 +        m = reg.match(line)
    8.81 +
    8.82 +        if not m: print >> sys.stderr, "Invalid input line."
    8.83 +
    8.84 +        s = string.split(m.group(4))
    8.85 +
    8.86 +        args = {'cpu'   : m.group(1),
    8.87 +                'tsc'   : m.group(2),
    8.88 +                'event' : m.group(3) }
    8.89 +
    8.90 +        i = 0
    8.91 +        for item in s:
    8.92 +            args[str(i)] = item
    8.93 +            i += 1
    8.94 +
    8.95 +        if defs.has_key(m.group(3)): print defs[m.group(3)] % args
    8.96 +        # silently skip lines we don't have a format for - a 'complain' option
    8.97 +        # should be added if needed
    8.98 +
    8.99 +    except IOError: sys.exit()
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/tools/xentrace/xentrace_format.1	Thu Mar 11 19:55:00 2004 +0000
     9.3 @@ -0,0 +1,38 @@
     9.4 +.TH XENTRACE_FORMAT 1 "11 March 2004" "Xen domain 0 utils"
     9.5 +.SH NAME
     9.6 +xentrace_format \- pretty-print Xen trace data
     9.7 +.SH SYNOPSIS
     9.8 +.B xentrace_format
     9.9 +[
    9.10 +.I DEFS-FILE
    9.11 +]
    9.12 +.SH DESCRIPTION
    9.13 +.B xentrace_format
    9.14 +parses trace data from standard input and reformats it according to
    9.15 +the rules in a file of definitions (\fIDEFS-FILE\fP), printing to
    9.16 +standard output.
    9.17 +
    9.18 +The rules in \fIDEFS-FILE\fP should have the format shown below:
    9.19 +
    9.20 +\fIevent_id\fP \fIwhitespace\fP \fIformat\fP
    9.21 +
    9.22 +Each rule should start on a new line.
    9.23 +
    9.24 +The format string may include the following format specifiers:
    9.25 +%(cpu)s, %(tsc), %(event)s, %(1)s, %(2)s, %(3)s, %(4)s, %(5)s
    9.26 +
    9.27 +These correspond to the CPU number, event ID, timestamp counter and
    9.28 +the 5 data fields from the trace record.  There should be one such
    9.29 +rule for each type of event to be pretty-printed (events which do not
    9.30 +have formatting rules are ignored).
    9.31 +          
    9.32 +Depending on your system and the rate at which trace data is produced,
    9.33 +this script may not be able to keep up with the output of
    9.34 +\fBxentrace\fP if it is piped directly.  In these circumstances you
    9.35 +should have \fBxentrace\fP output to a file for processing off-line.
    9.36 +
    9.37 +.SH AUTHOR
    9.38 +Mark A. Williamson <mark.a.williamson@intel.com>
    9.39 +
    9.40 +.SH "SEE ALSO"
    9.41 +xentrace(8), xentrace_cpusplit(1)
    10.1 --- a/tools/xentrace/xentrace_format.py	Thu Mar 11 17:26:10 2004 +0000
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,96 +0,0 @@
    10.4 -#!/usr/bin/env python
    10.5 -
    10.6 -# by Mark Williamson, (C) 2004 Intel Research Cambridge
    10.7 -
    10.8 -# Program for reformatting trace buffer output according to user-supplied rules
    10.9 -
   10.10 -import re, sys, string, signal
   10.11 -
   10.12 -def usage():
   10.13 -    print >> sys.stderr, \
   10.14 -          "Usage: " + sys.argv[0] + """ defs-file
   10.15 -          Parses trace data in ASCII format and reformats it according to the
   10.16 -          rules in a file of definitions.  The rules in this file should have
   10.17 -          the format ({ and } show grouping and are not part of the syntax):
   10.18 -
   10.19 -          {event_id}{whitespace}{text format string}
   10.20 -
   10.21 -          The textual format string may include the format specifiers:
   10.22 -            %(cpu)s, %(tsc), %(event)s, %(1)s, %(2)s, %(3)s, %(4)s, %(5)s
   10.23 -
   10.24 -          Which correspond to the CPU number, event ID, timestamp counter and
   10.25 -          the 5 data fields from the trace record.  There should be one such
   10.26 -          rule for each type of event.
   10.27 -          
   10.28 -          Depending on your system and the volume of trace buffer data,
   10.29 -          this script may not be able to keep up with the output of xentrace
   10.30 -          if it is piped directly.  In these circumstances you should have
   10.31 -          xentrace output to a file for processing off-line.
   10.32 -          """
   10.33 -    sys.exit(1)
   10.34 -
   10.35 -def read_defs(defs_file):
   10.36 -    defs = {}
   10.37 -    
   10.38 -    fd = open(defs_file)
   10.39 -
   10.40 -    reg = re.compile('(\d+)\s+(\S.*)')
   10.41 -
   10.42 -    while True:
   10.43 -        line = fd.readline()
   10.44 -        if not line:
   10.45 -            break
   10.46 -        
   10.47 -        m = reg.match(line)
   10.48 -
   10.49 -        if not m: print >> sys.stderr, "Bad format file" ; sys.exit(1)
   10.50 -        
   10.51 -        defs[m.group(1)] = m.group(2)
   10.52 -
   10.53 -    return defs
   10.54 -
   10.55 -def sighand(x,y):
   10.56 -    global interrupted
   10.57 -    interrupted = 1
   10.58 -
   10.59 -##### Main code
   10.60 -
   10.61 -if len(sys.argv) < 2:
   10.62 -    usage()
   10.63 -
   10.64 -signal.signal(signal.SIGTERM, sighand)
   10.65 -signal.signal(signal.SIGHUP,  sighand)
   10.66 -signal.signal(signal.SIGINT,  sighand)
   10.67 -
   10.68 -interrupted = 0
   10.69 -
   10.70 -defs = read_defs(sys.argv[1])
   10.71 -
   10.72 -reg = re.compile('(\d+) (\d+) (\d+) (.*)')
   10.73 -
   10.74 -while not interrupted:
   10.75 -    try:
   10.76 -        line = sys.stdin.readline()
   10.77 -        if not line:
   10.78 -            break
   10.79 -
   10.80 -        m = reg.match(line)
   10.81 -
   10.82 -        if not m: print >> sys.stderr, "Invalid input line."
   10.83 -
   10.84 -        s = string.split(m.group(4))
   10.85 -
   10.86 -        args = {'cpu'   : m.group(1),
   10.87 -                'tsc'   : m.group(2),
   10.88 -                'event' : m.group(3) }
   10.89 -
   10.90 -        i = 0
   10.91 -        for item in s:
   10.92 -            args[str(i)] = item
   10.93 -            i += 1
   10.94 -
   10.95 -        if defs.has_key(m.group(3)): print defs[m.group(3)] % args
   10.96 -        # silently skip lines we don't have a format for - a 'complain' option
   10.97 -        # should be added if needed
   10.98 -
   10.99 -    except IOError: sys.exit()