qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 10/10] trace: [tcg] Generate TCG code to trace gu


From: Lluís Vilanova
Subject: [Qemu-devel] [PATCH v2 10/10] trace: [tcg] Generate TCG code to trace guest events on a per-vCPU basis
Date: Tue, 24 Nov 2015 18:09:42 +0100
User-agent: StGit/0.17.1-dirty

Events with the 'tcg' and 'vcpu' properties will:

* Trace the translation-time event ('*_trans').
* Generate TCG code to call a function that traces the execution-time
  event ('*_exec') iff the event is enabled for that vCPU.

Signed-off-by: Lluís Vilanova <address@hidden>
---
 scripts/tracetool/format/tcg_h.py |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/tracetool/format/tcg_h.py 
b/scripts/tracetool/format/tcg_h.py
index 222002c..2ecfc53 100644
--- a/scripts/tracetool/format/tcg_h.py
+++ b/scripts/tracetool/format/tcg_h.py
@@ -32,7 +32,7 @@ def generate(events, backend):
 
     for e in events:
         # just keep one of them
-        if "tcg-trans" not in e.properties:
+        if "tcg-exec" not in e.properties:
             continue
 
         # get the original event definition
@@ -52,7 +52,11 @@ def generate(events, backend):
 
         if "disable" not in e.properties:
             out('    %(name_trans)s(%(argnames_trans)s);',
-                '    gen_helper_%(name_exec)s(%(argnames_exec)s);',
+                '    if (%(cond)s) {',
+                '        gen_helper_%(name_exec)s(%(argnames_exec)s);',
+                '    }',
+                cond='trace_event_get_cpu_state(_cpu, TRACE_%s)' % 
e.event_exec.name.upper()
+                     if "vcpu" in e.properties else "true",
                 name_trans=e.event_trans.api(e.QEMU_TRACE),
                 name_exec=e.event_exec.api(e.QEMU_TRACE),
                 argnames_trans=", ".join(e.event_trans.args.names()),




reply via email to

[Prev in Thread] Current Thread [Next in Thread]