diff options
Diffstat (limited to 'scripts/tracetool.py')
-rwxr-xr-x | scripts/tracetool.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/scripts/tracetool.py b/scripts/tracetool.py index f66e767271..629b2593c8 100755 --- a/scripts/tracetool.py +++ b/scripts/tracetool.py @@ -15,6 +15,8 @@ __email__ = "stefanha@linux.vnet.ibm.com" import sys import getopt +import os.path +import re from tracetool import error_write, out import tracetool.backend @@ -60,6 +62,15 @@ Options: else: sys.exit(1) +def make_group_name(filename): + dirname = os.path.realpath(os.path.dirname(filename)) + basedir = os.path.join(os.path.dirname(__file__), os.pardir) + basedir = os.path.realpath(os.path.abspath(basedir)) + dirname = dirname[len(basedir) + 1:] + + if dirname == "": + return "common" + return re.sub(r"/|-", "_", dirname) def main(args): global _SCRIPT @@ -134,8 +145,10 @@ def main(args): with open(args[0], "r") as fh: events = tracetool.read_events(fh) + group = make_group_name(args[0]) + try: - tracetool.generate(events, arg_format, arg_backends, + tracetool.generate(events, group, arg_format, arg_backends, binary=binary, probe_prefix=probe_prefix) except tracetool.TracetoolError as e: error_opt(str(e)) |