summary refs log tree commit diff stats
path: root/scripts
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-09-29 17:49:27 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2025-10-01 11:22:07 -0400
commit02d4a4a674d45d41c9afd1fd161c14eca81f7a86 (patch)
tree94b23bbfb2fe1b5dc3ded4e53c9b1c12ac6d4746 /scripts
parent6f94ad27f0014c04a2aa403988acc22740a21196 (diff)
downloadfocaccia-qemu-02d4a4a674d45d41c9afd1fd161c14eca81f7a86.tar.gz
focaccia-qemu-02d4a4a674d45d41c9afd1fd161c14eca81f7a86.zip
trace/ftrace: move snprintf+write from tracepoints to ftrace.c
This simplifies the Python code and reduces the size of the tracepoints.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20250929154938.594389-6-pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/tracetool/backend/ftrace.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backend/ftrace.py
index a14aafcee6..8c0ce3f23a 100644
--- a/scripts/tracetool/backend/ftrace.py
+++ b/scripts/tracetool/backend/ftrace.py
@@ -28,18 +28,10 @@ def generate_h(event, group):
     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)) {',
+    out('    if (trace_event_get_state(%(event_id)s)) {',
         '#line %(event_lineno)d "%(event_filename)s"',
-        '            trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN,',
-        '                             "%(name)s " %(fmt)s "\\n" %(argnames)s);',
+        '        ftrace_write("%(name)s " %(fmt)s "\\n" %(argnames)s);',
         '#line %(out_next_lineno)d "%(out_filename)s"',
-        '            trlen = MIN(trlen, MAX_TRACE_STRLEN - 1);',
-        '            unused = write(trace_marker_fd, ftrace_buf, trlen);',
-        '        }',
         '    }',
         name=event.name,
         args=event.args,