aboutsummaryrefslogtreecommitdiff
path: root/scripts/tracetool.py
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2020-08-27 15:29:12 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2021-01-04 14:24:58 +0000
commitc05012a365c2d7d42d205b1efa895bf2144bab88 (patch)
treeb7a25025de22f351f41d84dfdf621d16dc87fa3b /scripts/tracetool.py
parent6745c8a01f759b64d3c4cd1e0a69bb793cead268 (diff)
downloadqemu-c05012a365c2d7d42d205b1efa895bf2144bab88.zip
qemu-c05012a365c2d7d42d205b1efa895bf2144bab88.tar.gz
qemu-c05012a365c2d7d42d205b1efa895bf2144bab88.tar.bz2
tracetool: add output filename command-line argument
The tracetool.py script writes to stdout. This means the output filename is not available to the script. Add the output filename to the command-line so that the script has access to the filename. This also simplifies the tracetool.py invocation. It's no longer necessary to use meson's custom_build(capture : true) to save output. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200827142915.108730-2-stefanha@redhat.com>
Diffstat (limited to 'scripts/tracetool.py')
-rwxr-xr-xscripts/tracetool.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/tracetool.py b/scripts/tracetool.py
index 3114624..ab7653a 100755
--- a/scripts/tracetool.py
+++ b/scripts/tracetool.py
@@ -16,7 +16,7 @@ __email__ = "stefanha@redhat.com"
import sys
import getopt
-from tracetool import error_write, out
+from tracetool import error_write, out, out_open
import tracetool.backend
import tracetool.format
@@ -32,7 +32,7 @@ def error_opt(msg = None):
format_descr = "\n".join([ " %-15s %s" % (n, d)
for n,d in tracetool.format.get_list() ])
error_write("""\
-Usage: %(script)s --format=<format> --backends=<backends> [<options>]
+Usage: %(script)s --format=<format> --backends=<backends> [<options>] <trace-events> ... <output>
Backends:
%(backends)s
@@ -135,13 +135,15 @@ def main(args):
if probe_prefix is None:
probe_prefix = ".".join(["qemu", target_type, target_name])
- if len(args) < 1:
- error_opt("missing trace-events filepath")
+ if len(args) < 2:
+ error_opt("missing trace-events and output filepaths")
events = []
- for arg in args:
+ for arg in args[:-1]:
with open(arg, "r") as fh:
events.extend(tracetool.read_events(fh, arg))
+ out_open(args[-1])
+
try:
tracetool.generate(events, arg_group, arg_format, arg_backends,
binary=binary, probe_prefix=probe_prefix)