diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2014-05-08 12:38:01 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2014-05-08 12:38:01 +0100 |
| commit | 43cbeffb19877c62cbe0aaf08b2f235d98d71340 (patch) | |
| tree | 90a1d70eb7a165a8ddc923169651da2ab68edaac /scripts/tracetool/format/stap.py | |
| parent | 6b342cc9c872e82620fdd32730cd92affa8a19b3 (diff) | |
| parent | e00e36fb913217d49f57cc19d8d605270dd82bc5 (diff) | |
| download | focaccia-qemu-43cbeffb19877c62cbe0aaf08b2f235d98d71340.tar.gz focaccia-qemu-43cbeffb19877c62cbe0aaf08b2f235d98d71340.zip | |
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
Tracing pull request # gpg: Signature made Wed 07 May 2014 18:14:02 BST using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/tracing-pull-request: configure: Show trace output file conditionally trace: [tracetool] Minimize the amount of per-backend code trace: [simple] Bump up log version number trace: [tracetool] Change format docs to point to the generated file trace: [tracetool] Show list of frontends and backends sorted by name trace: [tracetool] Cosmetic changes trace: [tracetool] Spacing changes trace: [tracetool] Add methods 'Event.copy' and 'Arguments.copy' trace: [tracetool] Add method 'Event.api' to build event names Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts/tracetool/format/stap.py')
| -rw-r--r-- | scripts/tracetool/format/stap.py | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/scripts/tracetool/format/stap.py b/scripts/tracetool/format/stap.py index 50a4c69954..e24abf7f11 100644 --- a/scripts/tracetool/format/stap.py +++ b/scripts/tracetool/format/stap.py @@ -6,7 +6,7 @@ Generate .stp file (DTrace with SystemTAP only). """ __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>" -__copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>" +__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>" __license__ = "GPL version 2 or (at your option) any later version" __maintainer__ = "Stefan Hajnoczi" @@ -14,7 +14,43 @@ __email__ = "stefanha@linux.vnet.ibm.com" from tracetool import out +from tracetool.backend.dtrace import binary, probeprefix -def begin(events): - out('/* This file is autogenerated by tracetool, do not edit. */') +# Technically 'self' is not used by systemtap yet, but +# they recommended we keep it in the reserved list anyway +RESERVED_WORDS = ( + 'break', 'catch', 'continue', 'delete', 'else', 'for', + 'foreach', 'function', 'global', 'if', 'in', 'limit', + 'long', 'next', 'probe', 'return', 'self', 'string', + 'try', 'while' + ) + + +def generate(events, backend): + events = [e for e in events + if "disable" not in e.properties] + + out('/* This file is autogenerated by tracetool, do not edit. */', + '') + + for e in events: + # Define prototype for probe arguments + out('probe %(probeprefix)s.%(name)s = process("%(binary)s").mark("%(name)s")', + '{', + probeprefix=probeprefix(), + name=e.name, + binary=binary()) + + i = 1 + if len(e.args) > 0: + for name in e.args.names(): + # Append underscore to reserved keywords + if name in RESERVED_WORDS: + name += '_' + out(' %s = $arg%d;' % (name, i)) + i += 1 + + out('}') + + out() |