diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-09-29 17:49:27 +0200 |
|---|---|---|
| committer | Stefan Hajnoczi <stefanha@redhat.com> | 2025-10-01 11:22:07 -0400 |
| commit | 02d4a4a674d45d41c9afd1fd161c14eca81f7a86 (patch) | |
| tree | 94b23bbfb2fe1b5dc3ded4e53c9b1c12ac6d4746 /tests | |
| parent | 6f94ad27f0014c04a2aa403988acc22740a21196 (diff) | |
| download | focaccia-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 'tests')
| -rw-r--r-- | tests/tracetool/ftrace.h | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/tests/tracetool/ftrace.h b/tests/tracetool/ftrace.h index fe22ea0f09..1dfe423941 100644 --- a/tests/tracetool/ftrace.h +++ b/tests/tracetool/ftrace.h @@ -21,18 +21,10 @@ extern uint16_t _TRACE_TEST_WIBBLE_DSTATE; static inline void trace_test_blah(void *context, const char *filename) { - { - char ftrace_buf[MAX_TRACE_STRLEN]; - int unused __attribute__ ((unused)); - int trlen; - if (trace_event_get_state(TRACE_TEST_BLAH)) { + if (trace_event_get_state(TRACE_TEST_BLAH)) { #line 4 "trace-events" - trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN, - "test_blah " "Blah context=%p filename=%s" "\n" , context, filename); -#line 33 "ftrace.h" - trlen = MIN(trlen, MAX_TRACE_STRLEN - 1); - unused = write(trace_marker_fd, ftrace_buf, trlen); - } + ftrace_write("test_blah " "Blah context=%p filename=%s" "\n" , context, filename); +#line 28 "ftrace.h" } } @@ -42,18 +34,10 @@ static inline void trace_test_blah(void *context, const char *filename) static inline void trace_test_wibble(void *context, int value) { - { - char ftrace_buf[MAX_TRACE_STRLEN]; - int unused __attribute__ ((unused)); - int trlen; - if (trace_event_get_state(TRACE_TEST_WIBBLE)) { + if (trace_event_get_state(TRACE_TEST_WIBBLE)) { #line 5 "trace-events" - trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN, - "test_wibble " "Wibble context=%p value=%d" "\n" , context, value); -#line 54 "ftrace.h" - trlen = MIN(trlen, MAX_TRACE_STRLEN - 1); - unused = write(trace_marker_fd, ftrace_buf, trlen); - } + ftrace_write("test_wibble " "Wibble context=%p value=%d" "\n" , context, value); +#line 41 "ftrace.h" } } #endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */ |