summaryrefslogtreecommitdiff
path: root/scripts/tracetool/__init__.py
AgeCommit message (Collapse)AuthorFilesLines
2016-03-01trace: Add a proper API to manage auto-generated events from the 'tcg' propertyLluís Vilanova1-3/+10
Formalizes the existence of the 'event_trans' and 'event_exec' event attributes, which until now were monkey-patched only when necessary. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 145640558759.20978.6374959404425591089.stgit@localhost Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-03-01trace: Add 'vcpu' event property to trace guest vCPULluís Vilanova1-2/+9
This property identifies events that trace vCPU-specific information. It adds a "CPUState*" argument to events with the property, identifying the vCPU raising the event. TCG translation events also have a "TCGv_env" implicit argument that is later used as the "CPUState*" argument at execution time. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 145641861797.30295.6991314023181842105.stgit@localhost Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-03-01trace: Add helper function to cast event argumentsLluís Vilanova1-0/+4
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 145641860680.30295.1873612736245870753.stgit@localhost Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-03-01trace: Remove unnecessary intermediate event copiesLluís Vilanova1-3/+2
The current code forces the use of a chain of ".original" dereferences, which looks odd. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 145641858988.30295.7223459456488075843.stgit@localhost Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-03-01trace: Extend API to manage event argumentsLluís Vilanova1-2/+13
Lets the user manage event arguments as a list, and simplifies argument concatenation. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 145641858432.30295.3069911069472672646.stgit@localhost Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-11-18Tracing: Fix simpletrace.py error on tcg enabled binary tracesChristoph Seifert1-34/+33
simpletrace.py does not recognize the tcg option while reading trace-events file. In result simpletrace does not work on binary traces and tcg enabled events. Moved transformation of tcg enabled events to _read_events() which is used by simpletrace. Signed-off-by: Christoph Seifert <christoph.seifert@posteo.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-09-26scripts/tracetool: don't barf on formats with precisionAlex Bennée1-1/+1
This only affects lttng user space tracing at the moment. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-09-26trace: tighten up trace-events regex to fix bad parseStefan Hajnoczi1-2/+2
Use \w for properties and trace event names since they are both drawn from [a-zA-Z0-9_] character sets. The .* for matching properties was too aggressive and caused the following failure with foo(int rc) "(this is a test)": Traceback (most recent call last): File "scripts/tracetool.py", line 139, in <module> main(sys.argv) File "scripts/tracetool.py", line 134, in main binary=binary, probe_prefix=probe_prefix) File "scripts/tracetool/__init__.py", line 334, in generate events = _read_events(fevents) File "scripts/tracetool/__init__.py", line 262, in _read_events res.append(Event.build(line)) File "scripts/tracetool/__init__.py", line 225, in build return Event(name, props, fmt, args, arg_fmts) File "scripts/tracetool/__init__.py", line 185, in __init__ % ", ".join(unknown_props)) ValueError: Unknown properties: foo(int, rc) Cc: Lluís Vilanova <vilanova@ac.upc.edu> Reported-by: Eric Auger <eric.auger@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1411468626-20450-1-git-send-email-stefanha@redhat.com
2014-09-26trace: [ust] Fix format string computation in tcg-enabled eventsLluís Vilanova1-9/+10
TCG-enabled events start with two format strings. Delay per-argument format computation until requested ('Event.formats'). Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-08-12trace: teach lttng backend to use format stringsAlex Bennée1-2/+10
This makes the UST backend pay attention to the format string arguments that are defined when defining payload data. With this you can now ensure integers are reported in hex mode if you want. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-08-12trace: [tcg] Declare TCG tracing helper routinesLluís Vilanova1-0/+1
Generates file "trace/generated-helpers.h" with TCG helper declarations to trace events in guest code at execution time ('trace_${event}_exec_proxy'). Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-08-12trace: [tcg] Add 'tcg' event propertyLluís Vilanova1-5/+59
Transforms event: tcg name(...) "...", "..." into two internal events: tcg-trans name_trans(...) "..." tcg-exec name_exec(...) "..." Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-08-12trace: [tcg] Argument type transformation machineryLluís Vilanova1-1/+29
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-09trace: Multi-backend tracingLluís Vilanova1-13/+11
Adds support to compile QEMU with multiple tracing backends at the same time. For example, you can compile QEMU with: $ ./configure --enable-trace-backends=ftrace,dtrace Where 'ftrace' can be handy for having an in-flight record of events, and 'dtrace' can be later used to extract more information from the system. This patch allows having both available without recompiling QEMU. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-07trace: [tracetool] Minimize the amount of per-backend codeLluís Vilanova1-17/+2
Backends now only contain the essential backend-specific code, and most of the work is moved to frontend code. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-07trace: [tracetool] Cosmetic changesLluís Vilanova1-7/+7
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-07trace: [tracetool] Spacing changesLluís Vilanova1-3/+4
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-07trace: [tracetool] Add methods 'Event.copy' and 'Arguments.copy'Lluís Vilanova1-0/+9
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-07trace: [tracetool] Add method 'Event.api' to build event namesLluís Vilanova1-1/+9
Makes it easier to ensure proper naming across the different frontends and backends. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-05-01tracetool: avoid str.rpartition() Python 2.5 functionStefan Hajnoczi1-7/+10
The str.rpartition() function is related to str.split() and is used for splitting strings. It was introduced in Python 2.5 and therefore cannot be used in tracetool as Python 2.4 compatibility is required. Replace the code using str.rsplit(). Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu>
2012-05-01tracetool: use Python 2.4-compatible __import__() argumentsStefan Hajnoczi1-1/+1
In Python 2.5 keyword arguments were added to __import__(). Avoid using them to achieve Python 2.4 compatibility. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu>
2012-04-18tracetool: Add support for the 'dtrace' backendLluís Vilanova1-1/+10
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-04-18tracetool: Rewrite infrastructure as python modulesLluís Vilanova1-0/+262
The tracetool script is written in shell and has hit several portability problems due to shell quirks or external tools across host platforms. Additionally the amount of string processing and lack of real data structures makes it tough to implement code generator backends for tracers that are more complex. This patch replaces the shell version of tracetool with a Python version. The new tracetool design is: scripts/tracetool.py - top-level script scripts/tracetool/backend/ - tracer backends live here (simple, ust) scripts/tracetool/format/ - output formats live here (.c, .h) There is common code for trace-events definition parsing so that backends can focus on generating code rather than parsing input. Support for all existing backends (nop, stderr, simple, ust, and dtrace) is added back in follow-up patches. [Commit description written by Stefan Hajnoczi] Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>