summary refs log tree commit diff stats
path: root/scripts/tracetool/backend/ftrace.py
diff options
context:
space:
mode:
authorLluís Vilanova <vilanova@ac.upc.edu>2016-07-11 12:53:46 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2016-07-18 18:23:12 +0100
commit40b9cd25f789e02145fda5e1f3fde7e7dd9e3b61 (patch)
treea88b3cbcc13588e5234bddaa84bb2790c743eab5 /scripts/tracetool/backend/ftrace.py
parent4815185902971c41fcdd700fa1fc3e1d9299900f (diff)
downloadfocaccia-qemu-40b9cd25f789e02145fda5e1f3fde7e7dd9e3b61.tar.gz
focaccia-qemu-40b9cd25f789e02145fda5e1f3fde7e7dd9e3b61.zip
trace: Conditionally trace events based on their per-vCPU state
Events with the 'vcpu' property are conditionally emitted according to
their per-vCPU state. Other events are emitted normally based on their
global tracing state.

Note that the per-vCPU condition check applies to all tracing backends.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'scripts/tracetool/backend/ftrace.py')
-rw-r--r--scripts/tracetool/backend/ftrace.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backend/ftrace.py
index d798c71347..80dcf30478 100644
--- a/scripts/tracetool/backend/ftrace.py
+++ b/scripts/tracetool/backend/ftrace.py
@@ -30,17 +30,17 @@ def generate_h(event):
     if len(event.args) > 0:
         argnames = ", " + argnames
 
-    out('    {',
-        '        char ftrace_buf[MAX_TRACE_STRLEN];',
-        '        int unused __attribute__ ((unused));',
-        '        int trlen;',
-        '        if (trace_event_get_state(%(event_id)s)) {',
-        '            trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN,',
-        '                             "%(name)s " %(fmt)s "\\n" %(argnames)s);',
-        '            trlen = MIN(trlen, MAX_TRACE_STRLEN - 1);',
-        '            unused = write(trace_marker_fd, ftrace_buf, trlen);',
+    out('        {',
+        '            char ftrace_buf[MAX_TRACE_STRLEN];',
+        '            int unused __attribute__ ((unused));',
+        '            int trlen;',
+        '            if (trace_event_get_state(%(event_id)s)) {',
+        '                trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN,',
+        '                                 "%(name)s " %(fmt)s "\\n" %(argnames)s);',
+        '                trlen = MIN(trlen, MAX_TRACE_STRLEN - 1);',
+        '                unused = write(trace_marker_fd, ftrace_buf, trlen);',
+        '            }',
         '        }',
-        '    }',
         name=event.name,
         args=event.args,
         event_id="TRACE_" + event.name.upper(),