trace: bugfixes, cleanups and optimizations
cover trace: bugfixes, cleanups and optimizations
This series started off with fixing some compile failures seen with dtrace and ust backends, and got somewhat out of hand as I looked more deeply at the trace code. So it ended up doing various bits of code cleanup and memory usage optimizations.
The optimizations aren't huge against each individual binaries. There are too many scenarios to show the full set, but here are some binary size examples
The current git master baseline for different enabled backends on the x86_64 emulator:
nop 88546360
dtrace 90604496
ftrace 93265944
log 93799528
syslog 93962704
simple 97064528
ust 162999944
dtrace,ftrace,log,syslog,simple,ust 174438088
'ust' has insanely high overhead in terms of binary sizes, inexplicably insane.
'ftrace/log/syslog' are all similar because their overhead is dominated by the printf() format strings which are identical in all.
'simple' is a bit worse because of the helper functions we must generated for each probe
After this series is applied the results for x86_64 are
nop 88510248
dtrace 90576160
ftrace 93156320
log 93735064
syslog 93853480
simple 97050856
ust 162957256
dtrace,ftrace,log,syslog,simple,ust 174431128
IOW, for 'dtrace', we save 28k, for 'log' we save 62k
For the aarch64 binary, we see bigger saving in some cases:
baseline dtrace 127610144
baseline log 131050320
trace dtrace 127459264
trace log 130998872IOW, for 'dtrace' we save 150k, for 'log' we only save 50k. No clue why the saving is not so significant for the 'log' backend but not a big deal.
Daniel P. Berrangé (20):
osdep: add 'ignore_value(x)' macro
trace: use 'ignore_value()' instead of a dummy variable
trace: fix handling of char** in UST backend
hw/xen: replace "long unsigned int" with "unsigned long " for dtrace
trace: block use of "long int" for dtrace
trace: drop unused trace_event_set_state_dynamic_init()
trace: remove obsolete references to vcpu property
trace: drop 'id' from TraceEvent struct when not required
trace: change "DSTATE" variables from uint16_t to uint8_t
trace: add testing of 'nop' trace backend
trace: don't emit TraceEvent structs when 'nop' backend is used
trace: add test of generation with all backends enabled
trace: remove redundant headers from simple trace backend code
audio: remove mistaken use of trace_event_get_state() hw/ppc: remove mistaken use of trace_event_get_state()
trace: include qemu_loglevel_mask(LOG_TRACE) in guard
trace: remove "disable" property from trace files
trace: stop tracking static disabled state
trace: remove parsing of "disable" event property
trace: remove 'trace_event_get_state' wrapper
audio/audio-mixeng-be.c | 2 +- hw/display/trace-events | 2 +- hw/ppc/vof.c | 13 +-- hw/xen/trace-events | 4 +- include/qemu/osdep.h | 8 ++ monitor/qmp.c | 4 +- qapi/trace.json | 5 +- scripts/tracetool/__init__.py | 32 ++---- scripts/tracetool/backend/__init__.py | 3 +- scripts/tracetool/backend/dtrace.py | 2 - scripts/tracetool/backend/log.py | 3 +- scripts/tracetool/backend/simple.py | 4 +- scripts/tracetool/format/c.py | 74 +++++++------- scripts/tracetool/format/d.py | 3 - scripts/tracetool/format/h.py | 42 ++++---- scripts/tracetool/format/log_stap.py | 3 - scripts/tracetool/format/rs.py | 30 +++--- scripts/tracetool/format/simpletrace_stap.py | 3 - scripts/tracetool/format/stap.py | 3 - scripts/tracetool/format/ust_events_c.py | 3 - scripts/tracetool/format/ust_events_h.py | 7 +- stubs/trace-control.c | 6 -- target/hppa/trace-events | 28 ++--- tests/tracetool/all.c | 61 +++++++++++ tests/tracetool/all.d | 10 ++ tests/tracetool/all.h | 102 +++++++++++++++++++ tests/tracetool/all.log-stap | 15 +++ tests/tracetool/all.rs | 90 ++++++++++++++++ tests/tracetool/all.simpletrace-stap | 16 +++ tests/tracetool/all.stap | 14 +++ tests/tracetool/all.ust-events-c | 14 +++ tests/tracetool/all.ust-events-h | 56 ++++++++++ tests/tracetool/dtrace.c | 10 +- tests/tracetool/dtrace.h | 6 +- tests/tracetool/dtrace.rs | 6 +- tests/tracetool/ftrace.c | 10 +- tests/tracetool/ftrace.h | 14 ++- tests/tracetool/ftrace.rs | 6 +- tests/tracetool/log.c | 10 +- tests/tracetool/log.h | 20 ++-- tests/tracetool/log.rs | 6 +- tests/tracetool/meson.build | 4 +- tests/tracetool/nop.c | 7 ++ tests/tracetool/nop.h | 25 +++++ tests/tracetool/nop.rs | 51 ++++++++++ tests/tracetool/simple.c | 12 +-- tests/tracetool/simple.h | 10 +- tests/tracetool/simple.rs | 6 +- tests/tracetool/syslog.c | 10 +- tests/tracetool/syslog.h | 14 ++- tests/tracetool/syslog.rs | 6 +- tests/tracetool/tracetool-test.py | 12 ++- tests/tracetool/ust.c | 10 +- tests/tracetool/ust.h | 6 +- trace/control-internal.h | 8 +- trace/control-target.c | 29 ------ trace/control.c | 19 +--- trace/control.h | 43 +------- trace/event-internal.h | 19 +--- trace/ftrace.c | 3 +- trace/qmp.c | 47 +++------ trace/simple.c | 9 +- 62 files changed, 704 insertions(+), 396 deletions(-) create mode 100644 tests/tracetool/all.c create mode 100644 tests/tracetool/all.d create mode 100644 tests/tracetool/all.h create mode 100644 tests/tracetool/all.log-stap create mode 100644 tests/tracetool/all.rs create mode 100644 tests/tracetool/all.simpletrace-stap create mode 100644 tests/tracetool/all.stap create mode 100644 tests/tracetool/all.ust-events-c create mode 100644 tests/tracetool/all.ust-events-h create mode 100644 tests/tracetool/nop.c create mode 100644 tests/tracetool/nop.h create mode 100644 tests/tracetool/nop.rs
Signature · 1 line
2.55.0
PATCH 1/20 osdep: add 'ignore_value(x)' macro
Functions annotated with 'warn_unused_result' cannot be cast to (void) to silence the compiler. Add the ignore_vaule() macro which tricks the compiler into thinking the result is genuinely used, avoiding the need for manual workarounds where the return value is intentionally ignored.
This clever macro is derived from one originating with the GNULIB project:
https://gitweb.git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/ignore-value.h;hb=HEAD
but simplified since we don't need compat with old GCC and optimizing on clang is overkill.
--- include/qemu/osdep.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/qemu/osdep.h +8 -0
@@ -251,6 +251,14 @@ extern "C" {#endif +/* +* Merely casting to (void) is not sufficient for functions +* annotated with the "warn_unused_result" attribute +*/ +#define ignore_value (x) \ + (__extension__ ({ __typeof__(x) __x = (x); (void) __x; })) + +/* * For mingw, as of v6.0.0, the function implementing the assert macro is * not marked as noreturn, so the compiler cannot delete code following an
Signature · 1 line
2.55.0
PATCH 2/20 trace: use 'ignore_value()' instead of a dummy variable
In reply to Daniel P. BerrangéThis pattern is more concise than using a dummy variable which in turn needs annotating as unused.
--- trace/ftrace.c | 3 +-- trace/simple.c | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-)
trace/ftrace.c +1 -2
@@ -41,7 +41,6 @@ static int find_mount(char *mount_point, const char *fstype)void ftrace_write (const char *fmt, ...) {char ftrace_buf[MAX_TRACE_STRLEN ]; - int unused __attribute__ ((unused));int trlen;va_list ap;
@@ -50,7 +49,7 @@ void ftrace_write(const char *fmt, ...)va_end (ap); trlen =MIN (trlen,MAX_TRACE_STRLEN -1 ); - unused =write (trace_marker_fd, ftrace_buf, trlen); +ignore_value (write (trace_marker_fd, ftrace_buf, trlen)); }bool ftrace_init (void )
trace/simple.c +4 -5
@@ -163,7 +163,6 @@ static gpointer writeout_thread(gpointer opaque) } dropped;unsigned int idx =0 ;int dropped_count; - size_t unused __attribute__ ((unused));uint64_t type =TRACE_RECORD_TYPE_EVENT ;for (;;) {
@@ -179,13 +178,13 @@ static gpointer writeout_thread(gpointer opaque) }while (!g_atomic_int_compare_and_exchange (&dropped_events, dropped_count,0 )); dropped.rec.arguments[0 ] = dropped_count; - unused =fwrite (&type,sizeof (type),1 , trace_fp); - unused =fwrite (&dropped.rec, dropped.rec.length,1 , trace_fp); +ignore_value (fwrite (&type,sizeof (type),1 , trace_fp)); +ignore_value (fwrite (&dropped.rec, dropped.rec.length,1 , trace_fp)); }while (get_trace_record (idx, &recordptr)) { - unused =fwrite (&type,sizeof (type),1 , trace_fp); - unused =fwrite (recordptr, recordptr->length,1 , trace_fp); +ignore_value (fwrite (&type,sizeof (type),1 , trace_fp)); +ignore_value (fwrite (recordptr, recordptr->length,1 , trace_fp)); writeout_idx += recordptr->length;free (recordptr);/* don't use g_free, can deadlock when traced */ idx = writeout_idx %TRACE_BUF_LEN ;
Signature · 1 line
2.55.0
PATCH 3/20 trace: fix handling of char** in UST backend
In reply to Daniel P. BerrangéThe UST trace backend fails to compile on version 2.14.0, as we pass a "char **" arg as to ctf_string(), which only expects 'char *'. It should instead be treated the same way as generic pointers, and emitted as hex.
--- scripts/tracetool/format/ust_events_h.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/tracetool/format/ust_events_h.py +3 -1
@@ -72,7 +72,9 @@ def generate(events, backend, group): names = e.args.names() fmts = e.formats() for t,n,f in zip(types, names, fmts): - if ('char *' in t) or ('char*' in t): + if ('char **' in t) or ('char**' in t): + out(' ctf_integer_hex(' + t + ', ' + n + ', ' + n + ')') + elif ('char *' in t) or ('char*' in t): out(' ctf_string(' + n + ', ' + n + ')') elif ("%p" in f) or ("x" in f) or ("PRIx" in f): out(' ctf_integer_hex('+ t + ', ' + n + ', ' + n + ')')
Signature · 1 line
2.55.0
PATCH 4/20 hw/xen: replace "long unsigned int" with "unsigned long " for dtrace
In reply to Daniel P. Berrangédtrace (or at least systemtap's fake "dtrace" binary) doesn't like to see "int" and "long" together in the typename, it just wants the bare "long".
--- hw/xen/trace-events | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/xen/trace-events +2 -2
@@ -57,8 +57,8 @@ cpu_ioreq_config_read(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uin cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x" cpu_get_ioreq_from_shared_memory_req_not_ready(int state, int data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O request not ready: 0x%x, ptr: 0x%x, port: 0x%"PRIx64", data: 0x%"PRIx64", count: %u, size: %u" xen_main_loop_prepare_init_cpu(int id, void *cpu) "cpu_by_vcpu_id[%d]=%p" -xen_map_ioreq_server_shared_page(long unsigned int ioreq_pfn) "shared page at pfn 0x%lx" -xen_map_ioreq_server_buffered_io_page(long unsigned int ioreq_pfn) "buffered io page at pfn 0x%lx" +xen_map_ioreq_server_shared_page(unsigned long ioreq_pfn) "shared page at pfn 0x%lx" +xen_map_ioreq_server_buffered_io_page(unsigned long ioreq_pfn) "buffered io page at pfn 0x%lx" xen_map_ioreq_server_buffered_io_evtchn(int bufioreq_evtchn) "buffered io evtchn is 0x%x" destroy_hvm_domain_cannot_acquire_handle(void) "Cannot acquire xenctrl handle" destroy_hvm_domain_failed_action(const char *action, int sts, char *errno_s) "xc_domain_shutdown failed to issue %s, sts %d, %s"
Signature · 1 line
2.55.0
Re: [PATCH 04/20] hw/xen: replace "long unsigned int" with "unsigned long " for dtrace
Quoted 8 lines · Daniel P. Berrangé
dtrace (or at least systemtap's fake "dtrace" binary) doesn't like to see "int" and "long" together in the typename, it just wants the bare "long".
Signed-off-by Daniel P. Berrangé <[email protected]>--- hw/xen/trace-events | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
PATCH 5/20 trace: block use of "long int" for dtrace
In reply to Daniel P. Berrangédtrace (or at least systemtap's fake "dtrace" binary) complains about a syntax error due to use of "long int", as it wants a bare "long" type Enforce this when parsing the trace-events files.
--- scripts/tracetool/__init__.py | 5 +++++ 1 file changed, 5 insertions(+)
scripts/tracetool/__init__.py +5 -0
@@ -177,6 +177,11 @@ def out(*lines, **kwargs): def validate_type(name): bits = name.split(" ") + + if "long" in bits and "int" in bits: + raise ValueError("Invalid use of 'int' typename in %s, " + "use 'long' alone" % name) + for bit in bits: bit = re.sub(r"\*", "", bit) if bit == "":
Signature · 1 line
2.55.0
PATCH 6/20 trace: drop unused trace_event_set_state_dynamic_init()
In reply to Daniel P. BerrangéThe use of this method was mistakenly dropped in 0d4e995c73. When the 'vcpu' property was dropped, however, this became functionally identical to trace_event_set_state_dynamic().
--- stubs/trace-control.c | 5 ----- trace/control-target.c | 21 --------------------- trace/event-internal.h | 2 -- 3 files changed, 28 deletions(-)
stubs/trace-control.c +0 -5
@@ -11,11 +11,6 @@#include "trace/control.h" -void trace_event_set_state_dynamic_init (TraceEvent *ev,bool state) -{ -trace_event_set_state_dynamic (ev, state); -} -void trace_event_set_state_dynamic (TraceEvent *ev,bool state) {bool state_pre;
trace/control-target.c +0 -21
@@ -10,27 +10,6 @@#include "qemu/osdep.h" #include "trace/control.h" - -void trace_event_set_state_dynamic_init (TraceEvent *ev,bool state) -{ -bool state_pre; -assert (trace_event_get_state_static (ev)); -/* -* We ignore the "vcpu" property here, since no vCPUs have been created -* yet. Then dstate can only be 1 or 0. -*/ - state_pre = *ev->dstate; -if (state_pre != state) { -if (state) { - trace_events_enabled_count++; - *ev->dstate =1 ; - }else { - trace_events_enabled_count--; - *ev->dstate =0 ; - } - } -} -void trace_event_set_state_dynamic (TraceEvent *ev,bool state) {assert (trace_event_get_state_static (ev));
trace/event-internal.h +0 -2
@@ -37,6 +37,4 @@ typedef struct TraceEvent { uint16_t *dstate; } TraceEvent; -void trace_event_set_state_dynamic_init (TraceEvent *ev,bool state); -#endif /* TRACE__EVENT_INTERNAL_H */
Signature · 1 line
2.55.0
PATCH 7/20 trace: remove obsolete references to vcpu property
In reply to Daniel P. BerrangéThe 'vcpu' property for trace events was removed 2 years ago but some mentions of it remain in the code.
--- trace/control-target.c | 6 ------ trace/control.c | 6 ------ trace/control.h | 12 ------------ trace/event-internal.h | 11 ----------- 4 files changed, 35 deletions(-)
trace/control-target.c +0 -6
@@ -14,12 +14,6 @@ void trace_event_set_state_dynamic(TraceEvent *ev, bool state) {assert (trace_event_get_state_static (ev)); -/* -* There is no longer a "vcpu" property, dstate can only be 1 or -* 0. With it, we haven't instantiated any vCPU yet, so we will -* set a global state instead, and trace_init_vcpu will reconcile -* it afterwards. -*/ bool state_pre = *ev->dstate;if (state_pre != state) {if (state) {
trace/control.c +0 -6
@@ -37,7 +37,6 @@ typedef struct TraceEventGroup {static TraceEventGroup *event_groups;static size_t nevent_groups;static uint32_t next_id; -static uint32_t next_vcpu_id;#ifdef CONFIG_TRACE_SIMPLE static bool init_trace_on_startup;#endif
@@ -304,8 +303,3 @@ void trace_opt_parse(const char *optstr) trace_opts_file =g_strdup (qemu_opt_get (opts,"file" ));qemu_opts_del (opts); } - -uint32_t trace_get_vcpu_event_count (void ) -{ -return next_vcpu_id; -}
trace/control.h +0 -12
@@ -139,8 +139,6 @@ static bool trace_event_get_state_static(TraceEvent *ev);* trace_event_get_state_dynamic: * * Get the dynamic tracing state of an event. -* -* If the event has the 'vcpu' property, gets the OR'ed state of all vCPUs. */ static bool trace_event_get_state_dynamic (TraceEvent *ev);
@@ -149,8 +147,6 @@ static bool trace_event_get_state_dynamic(TraceEvent *ev);* * Set the dynamic tracing state of an event. * -* If the event has the 'vcpu' property, sets the state on all vCPUs. -* * Pre-condition: trace_event_get_state_static(ev) == true */ void trace_event_set_state_dynamic (TraceEvent *ev,bool state);
@@ -203,14 +199,6 @@ extern QemuOptsList qemu_trace_opts;*/ void trace_opt_parse (const char *optstr); -/** -* trace_get_vcpu_event_count: -* -* Return the number of known vcpu-specific events -*/ -uint32_t trace_get_vcpu_event_count (void ); - -#include "control-internal.h" #endif /* TRACE__CONTROL_H */
trace/event-internal.h +0 -11
@@ -10,12 +10,6 @@#ifndef TRACE__EVENT_INTERNAL_H #define TRACE__EVENT_INTERNAL_H -/* -* Special value for TraceEvent.vcpu_id field to indicate -* that the event is not VCPU specific -*/ -#define TRACE_VCPU_EVENT_NONE ((uint32_t)-1) -/** * TraceEvent: * @id: Unique event identifier.
@@ -23,11 +17,6 @@* @sstate: Static tracing state. * @dstate: Dynamic tracing state * -* Interpretation of @dstate depends on whether the event has the 'vcpu' -* property: -* - false: Boolean value indicating whether the event is active. -* - true : Integral counting the number of vCPUs that have this event enabled. -* * Opaque generic description of a tracing event. */ typedef struct TraceEvent {
Signature · 1 line
2.55.0
Re: [PATCH 07/20] trace: remove obsolete references to vcpu property
Quoted 11 lines · Daniel P. Berrangé
The 'vcpu' property for trace events was removed 2 years ago but some mentions of it remain in the code.
Fixes 7ffc4894a6(trace: Remove deprecated 'vcpu' field from QMP trace events)Signed-off-by Daniel P. Berrangé <[email protected]>--- trace/control-target.c | 6 ------ trace/control.c | 6 ------ trace/control.h | 12 ------------ trace/event-internal.h | 11 ----------- 4 files changed, 35 deletions(-)
PATCH 8/20 trace: drop 'id' from TraceEvent struct when not required
In reply to Daniel P. BerrangéOnly "simpletrace" uses the "id" field from the TraceEvent struct. Omit it when this backend is not enabled to save memory.
--- scripts/tracetool/format/c.py | 2 ++ tests/tracetool/dtrace.c | 4 ++++ tests/tracetool/ftrace.c | 4 ++++ tests/tracetool/log.c | 4 ++++ tests/tracetool/simple.c | 4 ++++ tests/tracetool/syslog.c | 4 ++++ tests/tracetool/ust.c | 4 ++++ trace/control-internal.h | 2 ++ trace/control.c | 4 +++- trace/control.h | 3 ++- trace/event-internal.h | 2 ++ 11 files changed, 35 insertions(+), 2 deletions(-)
scripts/tracetool/format/c.py +2 -0
@@ -34,7 +34,9 @@ def generate(events, backend, group): for e in events: out('TraceEvent %(event)s = {', + '#ifdef CONFIG_TRACE_SIMPLE', ' .id = 0,', + '#endif', ' .name = \"%(name)s\",', ' .sstate = %(sstate)s,', ' .dstate = &%(dstate)s',
tests/tracetool/dtrace.c +4 -0
@@ -8,13 +8,17 @@uint16_t _TRACE_TEST_BLAH_DSTATE;uint16_t _TRACE_TEST_WIBBLE_DSTATE;TraceEvent _TRACE_TEST_BLAH_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE .id =0 , +#endif .name ="test_blah" , .sstate =TRACE_TEST_BLAH_ENABLED , .dstate = &_TRACE_TEST_BLAH_DSTATE };TraceEvent _TRACE_TEST_WIBBLE_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE .id =0 , +#endif .name ="test_wibble" , .sstate =TRACE_TEST_WIBBLE_ENABLED , .dstate = &_TRACE_TEST_WIBBLE_DSTATE
tests/tracetool/ftrace.c +4 -0
@@ -8,13 +8,17 @@uint16_t _TRACE_TEST_BLAH_DSTATE;uint16_t _TRACE_TEST_WIBBLE_DSTATE;TraceEvent _TRACE_TEST_BLAH_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE .id =0 , +#endif .name ="test_blah" , .sstate =TRACE_TEST_BLAH_ENABLED , .dstate = &_TRACE_TEST_BLAH_DSTATE };TraceEvent _TRACE_TEST_WIBBLE_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE .id =0 , +#endif .name ="test_wibble" , .sstate =TRACE_TEST_WIBBLE_ENABLED , .dstate = &_TRACE_TEST_WIBBLE_DSTATE
tests/tracetool/log.c +4 -0
@@ -8,13 +8,17 @@uint16_t _TRACE_TEST_BLAH_DSTATE;uint16_t _TRACE_TEST_WIBBLE_DSTATE;TraceEvent _TRACE_TEST_BLAH_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE .id =0 , +#endif .name ="test_blah" , .sstate =TRACE_TEST_BLAH_ENABLED , .dstate = &_TRACE_TEST_BLAH_DSTATE };TraceEvent _TRACE_TEST_WIBBLE_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE .id =0 , +#endif .name ="test_wibble" , .sstate =TRACE_TEST_WIBBLE_ENABLED , .dstate = &_TRACE_TEST_WIBBLE_DSTATE
tests/tracetool/simple.c +4 -0
@@ -8,13 +8,17 @@uint16_t _TRACE_TEST_BLAH_DSTATE;uint16_t _TRACE_TEST_WIBBLE_DSTATE;TraceEvent _TRACE_TEST_BLAH_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE .id =0 , +#endif .name ="test_blah" , .sstate =TRACE_TEST_BLAH_ENABLED , .dstate = &_TRACE_TEST_BLAH_DSTATE };TraceEvent _TRACE_TEST_WIBBLE_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE .id =0 , +#endif .name ="test_wibble" , .sstate =TRACE_TEST_WIBBLE_ENABLED , .dstate = &_TRACE_TEST_WIBBLE_DSTATE
tests/tracetool/syslog.c +4 -0
@@ -8,13 +8,17 @@uint16_t _TRACE_TEST_BLAH_DSTATE;uint16_t _TRACE_TEST_WIBBLE_DSTATE;TraceEvent _TRACE_TEST_BLAH_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE .id =0 , +#endif .name ="test_blah" , .sstate =TRACE_TEST_BLAH_ENABLED , .dstate = &_TRACE_TEST_BLAH_DSTATE };TraceEvent _TRACE_TEST_WIBBLE_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE .id =0 , +#endif .name ="test_wibble" , .sstate =TRACE_TEST_WIBBLE_ENABLED , .dstate = &_TRACE_TEST_WIBBLE_DSTATE
tests/tracetool/ust.c +4 -0
@@ -8,13 +8,17 @@uint16_t _TRACE_TEST_BLAH_DSTATE;uint16_t _TRACE_TEST_WIBBLE_DSTATE;TraceEvent _TRACE_TEST_BLAH_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE .id =0 , +#endif .name ="test_blah" , .sstate =TRACE_TEST_BLAH_ENABLED , .dstate = &_TRACE_TEST_BLAH_DSTATE };TraceEvent _TRACE_TEST_WIBBLE_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE .id =0 , +#endif .name ="test_wibble" , .sstate =TRACE_TEST_WIBBLE_ENABLED , .dstate = &_TRACE_TEST_WIBBLE_DSTATE
trace/control-internal.h +2 -0
@@ -19,11 +19,13 @@ static inline bool trace_event_is_pattern(const char *str)return strchr (str,'*' ) !=NULL ; } +#ifdef CONFIG_TRACE_SIMPLE static inline uint32_t trace_event_get_id (TraceEvent *ev) {assert (ev !=NULL );return ev->id; } +#endif static inline const char *trace_event_get_name (TraceEvent *ev) {
trace/control.c +3 -1
@@ -36,8 +36,8 @@ typedef struct TraceEventGroup {static TraceEventGroup *event_groups;static size_t nevent_groups; -static uint32_t next_id;#ifdef CONFIG_TRACE_SIMPLE +static uint32_t next_id;static bool init_trace_on_startup;#endif static char *trace_opts_file;
@@ -65,10 +65,12 @@ QemuOptsList qemu_trace_opts = {void trace_event_register_group (TraceEvent **events) { +#ifdef CONFIG_TRACE_SIMPLE size_t i;for (i =0 ; events[i] !=NULL ; i++) { events[i]->id = next_id++; } +#endif event_groups =g_renew (TraceEventGroup, event_groups, nevent_groups +1 ); event_groups[nevent_groups].events = events; nevent_groups++;
trace/control.h +2 -1
@@ -81,13 +81,14 @@ TraceEvent *trace_event_name(const char *name);*/ static bool trace_event_is_pattern (const char *str); - +#ifdef CONFIG_TRACE_SIMPLE /** * trace_event_get_id: * * Get the identifier of an event. */ static uint32_t trace_event_get_id (TraceEvent *ev); +#endif /** * trace_event_get_name:
trace/event-internal.h +2 -0
@@ -20,7 +20,9 @@* Opaque generic description of a tracing event. */ typedef struct TraceEvent { +#ifdef CONFIG_TRACE_SIMPLE uint32_t id; +#endif const char * name; const bool sstate; uint16_t *dstate;
Signature · 1 line
2.55.0
PATCH 9/20 trace: change "DSTATE" variables from uint16_t to uint8_t
In reply to Daniel P. BerrangéPreviously these variables had two distinct semantics. For most probes DSTATE was treated as a simple boolean, while for vcpu probes it was treated as a bitmask of vCPU indexes.
With vcpu probes removed, it is now exclusively a boolean and thus using uint16_t is a waste of memory.
--- scripts/tracetool/format/c.py | 2 +- scripts/tracetool/format/h.py | 2 +- scripts/tracetool/format/rs.py | 4 ++-- tests/tracetool/dtrace.c | 4 ++-- tests/tracetool/dtrace.h | 4 ++-- tests/tracetool/dtrace.rs | 6 +++--- tests/tracetool/ftrace.c | 4 ++-- tests/tracetool/ftrace.h | 4 ++-- tests/tracetool/ftrace.rs | 6 +++--- tests/tracetool/log.c | 4 ++-- tests/tracetool/log.h | 4 ++-- tests/tracetool/log.rs | 6 +++--- tests/tracetool/simple.c | 4 ++-- tests/tracetool/simple.h | 4 ++-- tests/tracetool/simple.rs | 6 +++--- tests/tracetool/syslog.c | 4 ++-- tests/tracetool/syslog.h | 4 ++-- tests/tracetool/syslog.rs | 6 +++--- tests/tracetool/ust.c | 4 ++-- tests/tracetool/ust.h | 4 ++-- trace/event-internal.h | 2 +- 21 files changed, 44 insertions(+), 44 deletions(-)
scripts/tracetool/format/c.py +1 -1
@@ -30,7 +30,7 @@ def generate(events, backend, group): '') for e in events: - out('uint16_t %s;' % e.api(e.QEMU_DSTATE)) + out('uint8_t %s;' % e.api(e.QEMU_DSTATE)) for e in events: out('TraceEvent %(event)s = {',
scripts/tracetool/format/h.py +1 -1
@@ -32,7 +32,7 @@ def generate(events, backend, group): event = e.api(e.QEMU_EVENT)) for e in events: - out('extern uint16_t %s;' % e.api(e.QEMU_DSTATE)) + out('extern uint8_t %s;' % e.api(e.QEMU_DSTATE)) # static state for e in events:
scripts/tracetool/format/rs.py +2 -2
@@ -26,7 +26,7 @@ def generate(events, backend, group): '', '#[allow(dead_code)]', '#[inline(always)]', - 'fn trace_event_state_is_enabled(dstate: u16) -> bool {', + 'fn trace_event_state_is_enabled(dstate: u8) -> bool {', ' (unsafe { trace_events_enabled_count }) != 0 && dstate != 0', '}', '',
@@ -39,7 +39,7 @@ def generate(events, backend, group): for e in events: out(' #[allow(dead_code)]', - ' static mut %s: u16;' % e.api(e.QEMU_DSTATE)) + ' static mut %s: u8;' % e.api(e.QEMU_DSTATE)) out('}', '')
tests/tracetool/dtrace.c +2 -2
@@ -5,8 +5,8 @@#include "qemu/module.h" #include "trace-testsuite.h" -uint16_t _TRACE_TEST_BLAH_DSTATE; -uint16_t _TRACE_TEST_WIBBLE_DSTATE; +uint8_t _TRACE_TEST_BLAH_DSTATE; +uint8_t _TRACE_TEST_WIBBLE_DSTATE;TraceEvent _TRACE_TEST_BLAH_EVENT = { #ifdef CONFIG_TRACE_SIMPLE .id = 0,
tests/tracetool/dtrace.h +2 -2
@@ -8,8 +8,8 @@extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT; -extern uint16_t _TRACE_TEST_BLAH_DSTATE; -extern uint16_t _TRACE_TEST_WIBBLE_DSTATE; +extern uint8_t _TRACE_TEST_BLAH_DSTATE; +extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;#define TRACE_TEST_BLAH_ENABLED 1#define TRACE_TEST_WIBBLE_ENABLED 1#ifndef SDT_USE_VARIADIC
tests/tracetool/dtrace.rs +3 -3
@@ -8,7 +8,7 @@#[allow(dead_code)] #[inline(always)] -fn trace_event_state_is_enabled (dstate:u16 ) ->bool { +fn trace_event_state_is_enabled (dstate:u8 ) ->bool { (unsafe { trace_events_enabled_count }) !=0 && dstate !=0 }
@@ -18,9 +18,9 @@ fn trace_event_state_is_enabled(dstate: u16) -> bool { }extern "C" {#[allow(dead_code)] -static mut _TRACE_TEST_BLAH_DSTATE:u16 ; +static mut _TRACE_TEST_BLAH_DSTATE:u8 ;#[allow(dead_code)] -static mut _TRACE_TEST_WIBBLE_DSTATE:u16 ; +static mut _TRACE_TEST_WIBBLE_DSTATE:u8 ; }use std::cell::UnsafeCell ;
tests/tracetool/ftrace.c +2 -2
@@ -5,8 +5,8 @@#include "qemu/module.h" #include "trace-testsuite.h" -uint16_t _TRACE_TEST_BLAH_DSTATE; -uint16_t _TRACE_TEST_WIBBLE_DSTATE; +uint8_t _TRACE_TEST_BLAH_DSTATE; +uint8_t _TRACE_TEST_WIBBLE_DSTATE;TraceEvent _TRACE_TEST_BLAH_EVENT = { #ifdef CONFIG_TRACE_SIMPLE .id = 0,
tests/tracetool/ftrace.h +2 -2
@@ -8,8 +8,8 @@extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT; -extern uint16_t _TRACE_TEST_BLAH_DSTATE; -extern uint16_t _TRACE_TEST_WIBBLE_DSTATE; +extern uint8_t _TRACE_TEST_BLAH_DSTATE; +extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;#define TRACE_TEST_BLAH_ENABLED 1#define TRACE_TEST_WIBBLE_ENABLED 1#include "trace/ftrace.h"
tests/tracetool/ftrace.rs +3 -3
@@ -8,7 +8,7 @@#[allow(dead_code)] #[inline(always)] -fn trace_event_state_is_enabled (dstate:u16 ) ->bool { +fn trace_event_state_is_enabled (dstate:u8 ) ->bool { (unsafe { trace_events_enabled_count }) !=0 && dstate !=0 }
@@ -18,9 +18,9 @@ fn trace_event_state_is_enabled(dstate: u16) -> bool { }extern "C" {#[allow(dead_code)] -static mut _TRACE_TEST_BLAH_DSTATE:u16 ; +static mut _TRACE_TEST_BLAH_DSTATE:u8 ;#[allow(dead_code)] -static mut _TRACE_TEST_WIBBLE_DSTATE:u16 ; +static mut _TRACE_TEST_WIBBLE_DSTATE:u8 ; }#[inline(always)]
tests/tracetool/log.c +2 -2
@@ -5,8 +5,8 @@#include "qemu/module.h" #include "trace-testsuite.h" -uint16_t _TRACE_TEST_BLAH_DSTATE; -uint16_t _TRACE_TEST_WIBBLE_DSTATE; +uint8_t _TRACE_TEST_BLAH_DSTATE; +uint8_t _TRACE_TEST_WIBBLE_DSTATE;TraceEvent _TRACE_TEST_BLAH_EVENT = { #ifdef CONFIG_TRACE_SIMPLE .id = 0,
tests/tracetool/log.h +2 -2
@@ -8,8 +8,8 @@extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT; -extern uint16_t _TRACE_TEST_BLAH_DSTATE; -extern uint16_t _TRACE_TEST_WIBBLE_DSTATE; +extern uint8_t _TRACE_TEST_BLAH_DSTATE; +extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;#define TRACE_TEST_BLAH_ENABLED 1#define TRACE_TEST_WIBBLE_ENABLED 1#include "qemu/log-for-trace.h"
tests/tracetool/log.rs +3 -3
@@ -8,7 +8,7 @@#[allow(dead_code)] #[inline(always)] -fn trace_event_state_is_enabled (dstate:u16 ) ->bool { +fn trace_event_state_is_enabled (dstate:u8 ) ->bool { (unsafe { trace_events_enabled_count }) !=0 && dstate !=0 }
@@ -18,9 +18,9 @@ fn trace_event_state_is_enabled(dstate: u16) -> bool { }extern "C" {#[allow(dead_code)] -static mut _TRACE_TEST_BLAH_DSTATE:u16 ; +static mut _TRACE_TEST_BLAH_DSTATE:u8 ;#[allow(dead_code)] -static mut _TRACE_TEST_WIBBLE_DSTATE:u16 ; +static mut _TRACE_TEST_WIBBLE_DSTATE:u8 ; }#[inline(always)]
tests/tracetool/simple.c +2 -2
@@ -5,8 +5,8 @@#include "qemu/module.h" #include "trace-testsuite.h" -uint16_t _TRACE_TEST_BLAH_DSTATE; -uint16_t _TRACE_TEST_WIBBLE_DSTATE; +uint8_t _TRACE_TEST_BLAH_DSTATE; +uint8_t _TRACE_TEST_WIBBLE_DSTATE;TraceEvent _TRACE_TEST_BLAH_EVENT = { #ifdef CONFIG_TRACE_SIMPLE .id = 0,
tests/tracetool/simple.h +2 -2
@@ -8,8 +8,8 @@extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT; -extern uint16_t _TRACE_TEST_BLAH_DSTATE; -extern uint16_t _TRACE_TEST_WIBBLE_DSTATE; +extern uint8_t _TRACE_TEST_BLAH_DSTATE; +extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;#define TRACE_TEST_BLAH_ENABLED 1#define TRACE_TEST_WIBBLE_ENABLED 1void _simple_trace_test_blah (void *context,const char *filename);
tests/tracetool/simple.rs +3 -3
@@ -8,7 +8,7 @@#[allow(dead_code)] #[inline(always)] -fn trace_event_state_is_enabled (dstate:u16 ) ->bool { +fn trace_event_state_is_enabled (dstate:u8 ) ->bool { (unsafe { trace_events_enabled_count }) !=0 && dstate !=0 }
@@ -18,9 +18,9 @@ fn trace_event_state_is_enabled(dstate: u16) -> bool { }extern "C" {#[allow(dead_code)] -static mut _TRACE_TEST_BLAH_DSTATE:u16 ; +static mut _TRACE_TEST_BLAH_DSTATE:u8 ;#[allow(dead_code)] -static mut _TRACE_TEST_WIBBLE_DSTATE:u16 ; +static mut _TRACE_TEST_WIBBLE_DSTATE:u8 ; }#[inline(always)]
tests/tracetool/syslog.c +2 -2
@@ -5,8 +5,8 @@#include "qemu/module.h" #include "trace-testsuite.h" -uint16_t _TRACE_TEST_BLAH_DSTATE; -uint16_t _TRACE_TEST_WIBBLE_DSTATE; +uint8_t _TRACE_TEST_BLAH_DSTATE; +uint8_t _TRACE_TEST_WIBBLE_DSTATE;TraceEvent _TRACE_TEST_BLAH_EVENT = { #ifdef CONFIG_TRACE_SIMPLE .id = 0,
tests/tracetool/syslog.h +2 -2
@@ -8,8 +8,8 @@extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT; -extern uint16_t _TRACE_TEST_BLAH_DSTATE; -extern uint16_t _TRACE_TEST_WIBBLE_DSTATE; +extern uint8_t _TRACE_TEST_BLAH_DSTATE; +extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;#define TRACE_TEST_BLAH_ENABLED 1#define TRACE_TEST_WIBBLE_ENABLED 1#include <syslog.h>
tests/tracetool/syslog.rs +3 -3
@@ -8,7 +8,7 @@#[allow(dead_code)] #[inline(always)] -fn trace_event_state_is_enabled (dstate:u16 ) ->bool { +fn trace_event_state_is_enabled (dstate:u8 ) ->bool { (unsafe { trace_events_enabled_count }) !=0 && dstate !=0 }
@@ -18,9 +18,9 @@ fn trace_event_state_is_enabled(dstate: u16) -> bool { }extern "C" {#[allow(dead_code)] -static mut _TRACE_TEST_BLAH_DSTATE:u16 ; +static mut _TRACE_TEST_BLAH_DSTATE:u8 ;#[allow(dead_code)] -static mut _TRACE_TEST_WIBBLE_DSTATE:u16 ; +static mut _TRACE_TEST_WIBBLE_DSTATE:u8 ; }#[inline(always)]
tests/tracetool/ust.c +2 -2
@@ -5,8 +5,8 @@#include "qemu/module.h" #include "trace-testsuite.h" -uint16_t _TRACE_TEST_BLAH_DSTATE; -uint16_t _TRACE_TEST_WIBBLE_DSTATE; +uint8_t _TRACE_TEST_BLAH_DSTATE; +uint8_t _TRACE_TEST_WIBBLE_DSTATE;TraceEvent _TRACE_TEST_BLAH_EVENT = { #ifdef CONFIG_TRACE_SIMPLE .id = 0,
tests/tracetool/ust.h +2 -2
@@ -8,8 +8,8 @@extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT; -extern uint16_t _TRACE_TEST_BLAH_DSTATE; -extern uint16_t _TRACE_TEST_WIBBLE_DSTATE; +extern uint8_t _TRACE_TEST_BLAH_DSTATE; +extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;#define TRACE_TEST_BLAH_ENABLED 1#define TRACE_TEST_WIBBLE_ENABLED 1#include <lttng/tracepoint.h>
trace/event-internal.h +1 -1
@@ -25,7 +25,7 @@ typedef struct TraceEvent {#endif const char * name;const bool sstate; - uint16_t *dstate; + uint8_t *dstate; } TraceEvent;#endif /* TRACE__EVENT_INTERNAL_H */
Signature · 1 line
2.55.0
PATCH 10/20 trace: add testing of 'nop' trace backend
In reply to Daniel P. BerrangéThis will be used to demonstrate that tracetool outputs the bare minimum of code when tracing is disabled. Currently, as of this initial commit of reference output, too much code is generated.
--- tests/tracetool/meson.build | 1 + tests/tracetool/nop.c | 36 ++++++++++++++++++++++ tests/tracetool/nop.h | 29 ++++++++++++++++++ tests/tracetool/nop.rs | 51 +++++++++++++++++++++++++++++++ tests/tracetool/tracetool-test.py | 2 +- 5 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 tests/tracetool/nop.c create mode 100644 tests/tracetool/nop.h create mode 100644 tests/tracetool/nop.rs
tests/tracetool/meson.build +1 -0
@@ -5,6 +5,7 @@ test_env.set('PYTHONPATH', meson.project_source_root() / 'scripts') test_env.set('PYTHONIOENCODING', 'utf-8') backends = [ + 'nop', 'dtrace', 'ftrace', 'log',
tests/tracetool/nop.c new file +36 -0
@@ -0,0 +1,36 @@ +/* This file is autogenerated by tracetool, do not edit. */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qemu/module.h" +#include "trace-testsuite.h" + +uint8_t _TRACE_TEST_BLAH_DSTATE; +uint8_t _TRACE_TEST_WIBBLE_DSTATE; +TraceEvent _TRACE_TEST_BLAH_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE + .id =0 , +#endif + .name ="test_blah" , + .sstate =TRACE_TEST_BLAH_ENABLED , + .dstate = &_TRACE_TEST_BLAH_DSTATE +}; +TraceEvent _TRACE_TEST_WIBBLE_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE + .id =0 , +#endif + .name ="test_wibble" , + .sstate =TRACE_TEST_WIBBLE_ENABLED , + .dstate = &_TRACE_TEST_WIBBLE_DSTATE +}; +TraceEvent *testsuite_trace_events[] = { + &_TRACE_TEST_BLAH_EVENT, + &_TRACE_TEST_WIBBLE_EVENT, +NULL , +}; + +static void trace_testsuite_register_events (void ) +{ +trace_event_register_group (testsuite_trace_events); +} +trace_init (trace_testsuite_register_events)
tests/tracetool/nop.h new file +29 -0
@@ -0,0 +1,29 @@ +/* This file is autogenerated by tracetool, do not edit. */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef TRACE_TESTSUITE_GENERATED_TRACERS_H +#define TRACE_TESTSUITE_GENERATED_TRACERS_H + +#include "trace/control.h" + +extern TraceEvent _TRACE_TEST_BLAH_EVENT; +extern TraceEvent _TRACE_TEST_WIBBLE_EVENT; +extern uint8_t _TRACE_TEST_BLAH_DSTATE; +extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; +#define TRACE_TEST_BLAH_ENABLED 1 +#define TRACE_TEST_WIBBLE_ENABLED 1 + +#define TRACE_TEST_BLAH_BACKEND_DSTATE () ( \ + false) + +static inline void trace_test_blah (void *context,const char *filename) +{ +} + +#define TRACE_TEST_WIBBLE_BACKEND_DSTATE () ( \ + false) + +static inline void trace_test_wibble (void *context,int value) +{ +} +#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
tests/tracetool/nop.rs new file +51 -0
51 lines not on this page · raw message
tests/tracetool/tracetool-test.py +1 -1
@@ -14,7 +14,7 @@ def get_formats(backend): "c", "h", ] - if backend in {"dtrace", "ftrace", "log", "simple", "syslog"}: + if backend in {"nop", "dtrace", "ftrace", "log", "simple", "syslog"}: formats += ["rs"] if backend == "dtrace": formats += [
Signature · 1 line
2.55.0
PATCH 11/20 trace: don't emit TraceEvent structs when 'nop' backend is used
In reply to Daniel P. BerrangéThe 'nop' backend is a short-hand for no trace probe usage at all. The emitted functions become a no-op, and as such there is no need to emit the TraceEvent structs, nor the DSTATE variables they reference.
--- scripts/tracetool/format/c.py | 75 ++++++++++++++++++----------------- scripts/tracetool/format/h.py | 16 +++++--- tests/tracetool/nop.c | 29 -------------- tests/tracetool/nop.h | 6 +-- 4 files changed, 50 insertions(+), 76 deletions(-)
scripts/tracetool/format/c.py +38 -37
@@ -29,41 +29,42 @@ def generate(events, backend, group): '#include "%s"' % header, '') - for e in events: - out('uint8_t %s;' % e.api(e.QEMU_DSTATE)) - - for e in events: - out('TraceEvent %(event)s = {', - '#ifdef CONFIG_TRACE_SIMPLE', - ' .id = 0,', - '#endif', - ' .name = \"%(name)s\",', - ' .sstate = %(sstate)s,', - ' .dstate = &%(dstate)s', + if len(list(backend.backend_modules())): + for e in events: + out('uint8_t %s;' % e.api(e.QEMU_DSTATE)) + + for e in events: + out('TraceEvent %(event)s = {', + '#ifdef CONFIG_TRACE_SIMPLE', + ' .id = 0,', + '#endif', + ' .name = \"%(name)s\",', + ' .sstate = %(sstate)s,', + ' .dstate = &%(dstate)s', + '};', + event = e.api(e.QEMU_EVENT), + name = e.name, + sstate = "TRACE_%s_ENABLED" % e.name.upper(), + dstate = e.api(e.QEMU_DSTATE)) + + out('TraceEvent *%(group)s_trace_events[] = {', + group = group.lower()) + + for e in events: + out(' &%(event)s,', event = e.api(e.QEMU_EVENT)) + + out(' NULL,', '};', - event = e.api(e.QEMU_EVENT), - name = e.name, - sstate = "TRACE_%s_ENABLED" % e.name.upper(), - dstate = e.api(e.QEMU_DSTATE)) - - out('TraceEvent *%(group)s_trace_events[] = {', - group = group.lower()) - - for e in events: - out(' &%(event)s,', event = e.api(e.QEMU_EVENT)) - - out(' NULL,', - '};', - '') - - out('static void trace_%(group)s_register_events(void)', - '{', - ' trace_event_register_group(%(group)s_trace_events);', - '}', - 'trace_init(trace_%(group)s_register_events)', - group = group.lower()) - - backend.generate_begin(active_events, group) - for event in active_events: - backend.generate(event, group) - backend.generate_end(active_events, group) + '') + + out('static void trace_%(group)s_register_events(void)', + '{', + ' trace_event_register_group(%(group)s_trace_events);', + '}', + 'trace_init(trace_%(group)s_register_events)', + group = group.lower()) + + backend.generate_begin(active_events, group) + for event in active_events: + backend.generate(event, group) + backend.generate_end(active_events, group)
scripts/tracetool/format/h.py +10 -6
@@ -27,12 +27,16 @@ def generate(events, backend, group): '#include "%s"' % header, '') - for e in events: - out('extern TraceEvent %(event)s;', - event = e.api(e.QEMU_EVENT)) - - for e in events: - out('extern uint8_t %s;' % e.api(e.QEMU_DSTATE)) + if len(list(backend.backend_modules())): + for e in events: + out('extern TraceEvent %(event)s;', + event = e.api(e.QEMU_EVENT)) + + for e in events: + out('extern uint8_t %s;' % e.api(e.QEMU_DSTATE)) + else: + for e in events: + out('#define %s 0' % e.api(e.QEMU_DSTATE)) # static state for e in events:
tests/tracetool/nop.c +0 -29
@@ -5,32 +5,3 @@#include "qemu/module.h" #include "trace-testsuite.h" -uint8_t _TRACE_TEST_BLAH_DSTATE; -uint8_t _TRACE_TEST_WIBBLE_DSTATE; -TraceEvent _TRACE_TEST_BLAH_EVENT = { -#ifdef CONFIG_TRACE_SIMPLE - .id =0 , -#endif - .name ="test_blah" , - .sstate =TRACE_TEST_BLAH_ENABLED , - .dstate = &_TRACE_TEST_BLAH_DSTATE -}; -TraceEvent _TRACE_TEST_WIBBLE_EVENT = { -#ifdef CONFIG_TRACE_SIMPLE - .id =0 , -#endif - .name ="test_wibble" , - .sstate =TRACE_TEST_WIBBLE_ENABLED , - .dstate = &_TRACE_TEST_WIBBLE_DSTATE -}; -TraceEvent *testsuite_trace_events[] = { - &_TRACE_TEST_BLAH_EVENT, - &_TRACE_TEST_WIBBLE_EVENT, -NULL , -}; - -static void trace_testsuite_register_events (void ) -{ -trace_event_register_group (testsuite_trace_events); -} -trace_init (trace_testsuite_register_events)
tests/tracetool/nop.h +2 -4
@@ -6,10 +6,8 @@#include "trace/control.h" -extern TraceEvent _TRACE_TEST_BLAH_EVENT; -extern TraceEvent _TRACE_TEST_WIBBLE_EVENT; -extern uint8_t _TRACE_TEST_BLAH_DSTATE; -extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; +#define _TRACE_TEST_BLAH_DSTATE 0 +#define _TRACE_TEST_WIBBLE_DSTATE 0#define TRACE_TEST_BLAH_ENABLED 1#define TRACE_TEST_WIBBLE_ENABLED 1
Signature · 1 line
2.55.0
PATCH 12/20 trace: add test of generation with all backends enabled
In reply to Daniel P. BerrangéThis reveals potentially interesting patterns in the generated code when multiple backends are present.
--- tests/tracetool/all.c | 65 +++++++++++++++++ tests/tracetool/all.d | 10 +++ tests/tracetool/all.h | 102 +++++++++++++++++++++++++++ tests/tracetool/all.log-stap | 15 ++++ tests/tracetool/all.rs | 90 +++++++++++++++++++++++ tests/tracetool/all.simpletrace-stap | 16 +++++ tests/tracetool/all.stap | 14 ++++ tests/tracetool/all.ust-events-c | 14 ++++ tests/tracetool/all.ust-events-h | 56 +++++++++++++++ tests/tracetool/meson.build | 3 +- tests/tracetool/tracetool-test.py | 12 ++-- 11 files changed, 392 insertions(+), 5 deletions(-) create mode 100644 tests/tracetool/all.c create mode 100644 tests/tracetool/all.d create mode 100644 tests/tracetool/all.h create mode 100644 tests/tracetool/all.log-stap create mode 100644 tests/tracetool/all.rs create mode 100644 tests/tracetool/all.simpletrace-stap create mode 100644 tests/tracetool/all.stap create mode 100644 tests/tracetool/all.ust-events-c create mode 100644 tests/tracetool/all.ust-events-h
tests/tracetool/all.c new file +65 -0
@@ -0,0 +1,65 @@ +/* This file is autogenerated by tracetool, do not edit. */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qemu/module.h" +#include "trace-testsuite.h" + +uint8_t _TRACE_TEST_BLAH_DSTATE; +uint8_t _TRACE_TEST_WIBBLE_DSTATE; +TraceEvent _TRACE_TEST_BLAH_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE + .id =0 , +#endif + .name ="test_blah" , + .sstate =TRACE_TEST_BLAH_ENABLED , + .dstate = &_TRACE_TEST_BLAH_DSTATE +}; +TraceEvent _TRACE_TEST_WIBBLE_EVENT = { +#ifdef CONFIG_TRACE_SIMPLE + .id =0 , +#endif + .name ="test_wibble" , + .sstate =TRACE_TEST_WIBBLE_ENABLED , + .dstate = &_TRACE_TEST_WIBBLE_DSTATE +}; +TraceEvent *testsuite_trace_events[] = { + &_TRACE_TEST_BLAH_EVENT, + &_TRACE_TEST_WIBBLE_EVENT, +NULL , +}; + +static void trace_testsuite_register_events (void ) +{ +trace_event_register_group (testsuite_trace_events); +} +trace_init(trace_testsuite_register_events) +#include "qemu/osdep.h" +#include "trace/control.h" +#include "trace/simple.h" + +void _simple_trace_test_blah (void *context,const char *filename) +{ +TraceBufferRecord rec; +size_t argfilename_len = filename ?MIN (strlen (filename),MAX_TRACE_STRLEN ) :0 ; + +if (trace_record_start (&rec, _TRACE_TEST_BLAH_EVENT.id,8 +4 + argfilename_len)) { +return ;/* Trace Buffer Full, Event Dropped ! */ + } +trace_record_write_u64 (&rec, (uintptr_t )(uint64_t *)context); +trace_record_write_str (&rec, filename, argfilename_len); +trace_record_finish (&rec); +} + +void _simple_trace_test_wibble (void *context,int value) +{ +TraceBufferRecord rec; + +if (trace_record_start (&rec, _TRACE_TEST_WIBBLE_EVENT.id,8 +8 )) { +return ;/* Trace Buffer Full, Event Dropped ! */ + } +trace_record_write_u64 (&rec, (uintptr_t )(uint64_t *)context); +trace_record_write_u64 (&rec, (uint64_t )value); +trace_record_finish (&rec); +} +
tests/tracetool/all.d new file +10 -0
@@ -0,0 +1,10 @@ +/* This file is autogenerated by tracetool, do not edit. */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +provider qemu { + +probe test_blah(void * context,const char * filename); + +probe test_wibble(void * context,int value); + +};
tests/tracetool/all.h new file +102 -0
102 lines not on this page · raw message
tests/tracetool/all.log-stap new file +15 -0
@@ -0,0 +1,15 @@ +/* This file is autogenerated by tracetool, do not edit. */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +probe qemu.log.test_blah = qemu.test_blah ? +{ + try { + argfilename_str = filename ? user_string_n(filename, 512) : "<null>" + } catch {} + printf("%d@%d test_blah Blah context=%p filename=%s\n", pid(), gettimeofday_ns(), context, argfilename_str) +} +probe qemu.log.test_wibble = qemu.test_wibble ? +{ + printf("%d@%d test_wibble Wibble context=%p value=%d\n", pid(), gettimeofday_ns(), context, value) +} +
tests/tracetool/all.rs new file +90 -0
90 lines not on this page · raw message
tests/tracetool/all.simpletrace-stap new file +16 -0
@@ -0,0 +1,16 @@ +/* This file is autogenerated by tracetool, do not edit. */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +probe qemu.simpletrace.test_blah = qemu.test_blah ? +{ + try { + argfilename_str = filename ? user_string_n(filename, 512) : "<null>" + } catch {} + argfilename_len = strlen(argfilename_str) + printf("%8b%8b%8b%4b%4b%8b%4b%.*s", 1, 0, gettimeofday_ns(), 24 + 8 + 4 + argfilename_len, pid(), context, argfilename_len, argfilename_len, argfilename_str) +} +probe qemu.simpletrace.test_wibble = qemu.test_wibble ? +{ + printf("%8b%8b%8b%4b%4b%8b%8b", 1, 1, gettimeofday_ns(), 24 + 8 + 8, pid(), context, value) +} +
tests/tracetool/all.stap new file +14 -0
@@ -0,0 +1,14 @@ +/* This file is autogenerated by tracetool, do not edit. */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +probe qemu.test_blah = process("qemu").mark("test_blah") +{ + context = $arg1; + filename = $arg2; +} +probe qemu.test_wibble = process("qemu").mark("test_wibble") +{ + context = $arg1; + value = $arg2; +} +
tests/tracetool/all.ust-events-c new file +14 -0
@@ -0,0 +1,14 @@ +/* This file is autogenerated by tracetool, do not edit. */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" + +#define TRACEPOINT_DEFINE +#define TRACEPOINT_CREATE_PROBES + +/* If gcc version 4.7 or older is used, LTTng ust gives a warning when compiling with + -Wredundant-decls. + */ +#pragma GCC diagnostic ignored "-Wredundant-decls" + +#include "trace-ust-all.h"
tests/tracetool/all.ust-events-h new file +56 -0
56 lines not on this page · raw message
tests/tracetool/meson.build +2 -1
@@ -11,7 +11,8 @@ backends = [ 'log', 'simple', 'syslog', - 'ust' + 'ust', + 'all' ] # The tracetool-test.py program has portability problems on Windows.
tests/tracetool/tracetool-test.py +8 -4
@@ -14,16 +14,16 @@ def get_formats(backend): "c", "h", ] - if backend in {"nop", "dtrace", "ftrace", "log", "simple", "syslog"}: + if backend in {"nop", "dtrace", "ftrace", "log", "simple", "syslog", "all"}: formats += ["rs"] - if backend == "dtrace": + if backend in {"dtrace", "all"}: formats += [ "d", "log-stap", "simpletrace-stap", "stap", ] - if backend == "ust": + if backend in {"ust", "all"}: formats += [ "ust-events-c", "ust-events-h",
@@ -36,8 +36,12 @@ def test_tracetool_one(tracetool, backend, fmt, src_dir, build_dir): actual_file = Path(build_dir, rel_filename) expect_file = Path(src_dir, rel_filename) + backends = backend + if backends == "all": + backends = "dtrace,ftrace,log,simple,syslog,ust" + args = [sys.executable, tracetool, - f"--format={fmt}", f"--backends={backend}", "--group=testsuite"] + f"--format={fmt}", f"--backends={backends}", "--group=testsuite"] if fmt.find("stap") != -1: args += ["--binary=qemu", "--probe-prefix=qemu"]
Signature · 1 line
2.55.0
PATCH 13/20 trace: remove redundant headers from simple trace backend code
In reply to Daniel P. BerrangéThe main formatter for .h/.c files for generated trace code already includes osdep.h and control.h, so it is redundant for the simple trace backend to add them too.
--- scripts/tracetool/backend/simple.py | 4 +--- tests/tracetool/all.c | 2 -- tests/tracetool/simple.c | 2 -- 3 files changed, 1 insertion(+), 7 deletions(-)
scripts/tracetool/backend/simple.py +1 -3
@@ -48,9 +48,7 @@ def generate_h_backend_dstate(event, group): def generate_c_begin(events, group): - out('#include "qemu/osdep.h"', - '#include "trace/control.h"', - '#include "trace/simple.h"', + out('#include "trace/simple.h"', '')
tests/tracetool/all.c +0 -2
@@ -34,8 +34,6 @@ static void trace_testsuite_register_events(void)trace_event_register_group (testsuite_trace_events); } trace_init(trace_testsuite_register_events) -#include "qemu/osdep.h" -#include "trace/control.h" #include "trace/simple.h" void _simple_trace_test_blah (void *context,const char *filename)
tests/tracetool/simple.c +0 -2
@@ -34,8 +34,6 @@ static void trace_testsuite_register_events(void)trace_event_register_group (testsuite_trace_events); } trace_init(trace_testsuite_register_events) -#include "qemu/osdep.h" -#include "trace/control.h" #include "trace/simple.h" void _simple_trace_test_blah (void *context,const char *filename)
Signature · 1 line
2.55.0
PATCH 14/20 audio: remove mistaken use of trace_event_get_state()
In reply to Daniel P. BerrangéConditional checks must call trace_event_get_state_dynamic() which checks the state of all backends, while trace_event_get_state() only validates state for backends using QEMU's internal state tracking.
--- audio/audio-mixeng-be.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
audio/audio-mixeng-be.c +1 -1
@@ -1179,7 +1179,7 @@ void audio_run(AudioMixengBackend *s, const char *msg)audio_run_in (s);audio_run_capture (s); -if (trace_event_get_state (TRACE_AUDIO_RUN_POLL )) { +if (trace_event_get_state_backends (TRACE_AUDIO_RUN_POLL )) {/* Convert seconds to microseconds for trace event */ int64_t elapsed_us =g_timer_elapsed (s->run_timer,NULL ) *MICROSECONDS_PER_SECOND ;trace_audio_run_poll (msg, elapsed_us);
Signature · 1 line
2.55.0
Re: [PATCH 14/20] audio: remove mistaken use of trace_event_get_state()
Quoted 9 lines · Daniel P. Berrangé
Conditional checks must call
trace_event_get_state_dynamic()which checks the state of all backends, whiletrace_event_get_state()only validates state for backends using QEMU's internal state tracking.Signed-off-by Daniel P. Berrangé <[email protected]>--- audio/audio-mixeng-be.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH 14/20] audio: remove mistaken use of trace_event_get_state()
In reply to Daniel P. BerrangéQuoted 1 line
Conditional checks must call
trace_event_get_state_dynamic()
get_state_backends()?
Quoted 3 lines
which checks the state of all backends, while
trace_event_get_state()only validates state for backends using QEMU's internal state tracking.
I don't understand, tbh, but the doc & tracing.rst agree so,
Signature · 1 line
Marc-André Lureau <[email protected]>
Re: [PATCH 14/20] audio: remove mistaken use of trace_event_get_state()
Quoted 3 lines · On Thu, Oct 01, 2026 at 11:14:36PM +0400, [email protected] wrote:
Quoted 1 line
Conditional checks must call
trace_event_get_state_dynamic()
get_state_backends()?
Opps, yes.
Quoted 5 lines
Quoted 3 lines
which checks the state of all backends, while
trace_event_get_state()only validates state for backends using QEMU's internal state tracking.I don't understand, tbh, but the doc &
tracing.rstagree so,
We have a "uint16_t _TRACE....DSTATE" variable for each probe that tracks whether QEMU has marked it enabled or not. This is used to control the ftrace, syslog, log and simple trace backends, and what the -trace command line arg sets. This is what the trace_event_get_state() macro checks.
For the systemtap and ust backends, however, that variable is not used, as they use USDT which are dynamically enabled by the external tracing application. They proide a semaphore which can be checked to see if the USDT has been enabled.
The "TRACE...DSTATE()" macro (no leading underscore) expands to code that checks the systemtap/ust USDT semaphores *and* the QEMU "_TRACE...DSTATE" variable. This is what the correct trace_event_get_state_backends() macro checks, and thus what needs to be used to ensure things work with dtrace/ust backends, as well as the QEMU internal backends.
Quoted 1 line
Reviewed-by Marc-André Lureau <[email protected]>
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
PATCH 15/20 hw/ppc: remove mistaken use of trace_event_get_state()
In reply to Daniel P. BerrangéConditional checks must call trace_event_get_state_dynamic() which checks the state of all backends, while trace_event_get_state() only validates state for backends using QEMU's internal state tracking.
Furthermore, checking qemu_loglevel_mask() is inappropriate since there are many trace backends, of which 'log' is only one.
--- hw/ppc/vof.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
hw/ppc/vof.c +4 -9
@@ -252,8 +252,7 @@ static uint32_t vof_getprop(const void *fdt, uint32_t nodeph, uint32_t pname,*/ ret = proplen;/* Do not format a value if tracepoint is silent, for performance */ -if (trace_event_get_state (TRACE_VOF_GETPROP ) && -qemu_loglevel_mask (LOG_TRACE )) { +if (trace_event_get_state_backends (TRACE_VOF_GETPROP )) {prop_format (trval,sizeof (trval), prop, ret); } }
@@ -337,8 +336,7 @@ static uint32_t vof_setprop(MachineState *ms, void *fdt, Vof *vof, goto trace_exit; } -if (trace_event_get_state (TRACE_VOF_SETPROP ) && -qemu_loglevel_mask (LOG_TRACE )) { +if (trace_event_get_state_backends (TRACE_VOF_SETPROP )) {prop_format (trval,sizeof (trval), val, vallen); } ret = vallen;
@@ -584,8 +582,7 @@ static uint32_t vof_write(Vof *vof, uint32_t ihandle, uint32_t buf, }/* FIXME: there is no backend(s) yet so just call a trace */ -if (trace_event_get_state (TRACE_VOF_WRITE ) && -qemu_loglevel_mask (LOG_TRACE )) { +if (trace_event_get_state_backends (TRACE_VOF_WRITE )) { tmp[cb] ='\0' ;trace_vof_write (ihandle, cb, tmp); }
@@ -599,9 +596,7 @@ static void vof_claimed_dump(GArray *claimed)int i;OfClaimed c; -if (trace_event_get_state (TRACE_VOF_CLAIMED ) && -qemu_loglevel_mask (LOG_TRACE )) { - +if (trace_event_get_state_backends (TRACE_VOF_CLAIMED )) {for (i =0 ; i < claimed->len; ++i) { c =g_array_index (claimed, OfClaimed, i);trace_vof_claimed (c.start, c.start + c.size, c.size);
Signature · 1 line
2.55.0
Re: [PATCH 15/20] hw/ppc: remove mistaken use of trace_event_get_state()
Quoted 5 lines · Daniel P. Berrangé
Conditional checks must call
trace_event_get_state_dynamic()which checks the state of all backends, whiletrace_event_get_state()only validates state for backends using QEMU's internal state tracking.
Quoted 7 lines
Furthermore, checking
qemu_loglevel_mask()is inappropriate since there are many trace backends, of which 'log' is only one.Signed-off-by Daniel P. Berrangé <[email protected]>--- hw/ppc/vof.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
PATCH 16/20 trace: include qemu_loglevel_mask(LOG_TRACE) in guard
In reply to Daniel P. BerrangéIf emitting a trace event requires computation for the parameters passed to the probe, the callers should guard that computation with trace_event_by_state_backends(), which is a macro expanding to the a check of the "TRACE_...._DSTATE()" expression. For the log backend this should include a check for LOG_TRACE being present in the configured log level.
--- scripts/tracetool/backend/log.py | 3 ++- tests/tracetool/all.h | 6 ++++-- tests/tracetool/log.h | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-)
scripts/tracetool/backend/log.py +2 -1
@@ -42,7 +42,8 @@ def generate_h(event, group): def generate_h_backend_dstate(event, group): - out(' trace_event_get_state_dynamic_by_id(%(event_id)s) || \\', + out(' (trace_event_get_state_dynamic_by_id(%(event_id)s) && \\\n' + ' qemu_loglevel_mask(LOG_TRACE)) || \\', event_id="TRACE_" + event.name.upper()) def generate_rs(event, group):
tests/tracetool/all.h +4 -2
@@ -45,7 +45,8 @@ void _simple_trace_test_wibble(void *context, int value);#define TRACE_TEST_BLAH_BACKEND_DSTATE () ( \ QEMU_TEST_BLAH_ENABLED() || \ trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \ - trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \ + (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) && \ + qemu_loglevel_mask(LOG_TRACE)) || \ trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \ trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \ tracepoint_enabled(qemu, test_blah) || \
@@ -74,7 +75,8 @@ static inline void trace_test_blah(void *context, const char *filename)#define TRACE_TEST_WIBBLE_BACKEND_DSTATE () ( \ QEMU_TEST_WIBBLE_ENABLED() || \ trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \ - trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \ + (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) && \ + qemu_loglevel_mask(LOG_TRACE)) || \ trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \ trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \ tracepoint_enabled(qemu, test_wibble) || \
tests/tracetool/log.h +4 -2
@@ -16,7 +16,8 @@ extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;#define TRACE_TEST_BLAH_BACKEND_DSTATE () ( \ - trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \ + (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) && \ + qemu_loglevel_mask(LOG_TRACE)) || \ false)static inline void trace_test_blah (void *context,const char *filename)
@@ -31,7 +32,8 @@ static inline void trace_test_blah(void *context, const char *filename) }#define TRACE_TEST_WIBBLE_BACKEND_DSTATE () ( \ - trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \ + (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) && \ + qemu_loglevel_mask(LOG_TRACE)) || \ false)static inline void trace_test_wibble (void *context,int value)
Signature · 1 line
2.55.0
Re: [PATCH 16/20] trace: include qemu_loglevel_mask(LOG_TRACE) in guard
Quoted 6 lines · Daniel P. Berrangé
If emitting a trace event requires computation for the parameters passed to the probe, the callers should guard that computation with
trace_event_by_state_backends(), which is a macro expanding to the a check of the "TRACE_...._DSTATE()" expression. For the log backend this should include a check forLOG_TRACEbeing present in the configured log level.
This also needs something for Rust (apologies for the mailer damage):
scripts/tracetool/backend/log.py +6 -1
@@ -16,7 +16,6 @@ PUBLIC = True -CHECK_TRACE_EVENT_GET_STATE = True def generate_h_begin(events, group):
@@ -52,3 +51,9 @@ def generate_rs(event, group): ' }', fmt=expand_format_string(event.fmt, event.name + " "), args=event.args.rust_call_varargs()) + +def generate_rs_backend_dstate(event, group): + out(' unsafe { (bindings::qemu_loglevel & bindings::LOG_TRACE) != 0 && ' + + 'trace_event_state_is_enabled(_%(event_id)s_DSTATE) } ||', + event_id = 'TRACE_' + e.name.upper()) +
Paolo
Re: [PATCH 16/20] trace: include qemu_loglevel_mask(LOG_TRACE) in guard
Quoted 8 lines · Paolo Bonzini
Quoted 6 lines · Daniel P. Berrangé
If emitting a trace event requires computation for the parameters passed to the probe, the callers should guard that computation with
trace_event_by_state_backends(), which is a macro expanding to the a check of the "TRACE_...._DSTATE()" expression. For the log backend this should include a check forLOG_TRACEbeing present in the configured log level.This also needs something for Rust (apologies for the mailer damage):
Ok, I'll test that and include it in a future v3, since I already sent out v2 before seeing this.
Quoted 22 lines
scripts/tracetool/backend/log.py +3
-1@@ -16,7 +16,6 @@ PUBLIC = True -CHECK_TRACE_EVENT_GET_STATE = True def generate_h_begin(events, group):@@ -52,3 +51,9 @@ def generate_rs(event, group): ' }', fmt=expand_format_string(event.fmt, event.name + " "), args=event.args.rust_call_varargs()) + +def generate_rs_backend_dstate(event, group): + out(' unsafe { (bindings::qemu_loglevel & bindings::LOG_TRACE) != 0&& '
scripts/tracetool/backend/log.py +3
-0+ + 'trace_event_state_is_enabled(_%(event_id)s_DSTATE) } ||', + event_id = 'TRACE_' + e.name.upper()) +
Quoted 2 lines
Paolo
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Re: [PATCH 16/20] trace: include qemu_loglevel_mask(LOG_TRACE) in guard
Il ven 2 ott 2026, 13:04 Daniel P. Berrangé <[email protected]> ha scritto:
Quoted 8 lines · Paolo Bonzini
Quoted 7 lines · Daniel P. Berrangé
Quoted 6 lines
If emitting a trace event requires computation for the parameters passed to the probe, the callers should guard that computation with
trace_event_by_state_backends(), which is a macro expanding to the a check of the "TRACE_...._DSTATE()" expression. For the log backend this should include a check forLOG_TRACEbeing present in the configured log level.
Quoted 5 lines
Quoted 1 line
This also needs something for Rust (apologies for the mailer damage):
Ok, I'll test that and include it in a future v3, since I already sent out v2 before seeing this.
No hurry, it's just an optimization.
Paolo
Quoted 34 lines
---
a/scripts/tracetool/backend/log.pyQuoted 10 lines
+++
b/scripts/tracetool/backend/log.pyscripts/tracetool/backend/log.py +0
-1@@ -16,7 +16,6 @@ PUBLIC = True -CHECK_TRACE_EVENT_GET_STATE = True def generate_h_begin(events, group):scripts/tracetool/backend/log.py def generate_rs(event, group): · line 56
Quoted 6 lines
scripts/tracetool/backend/log.py +3
-0@@ -52,3 +51,9 @@ def generate_rs(event, group): ' }', fmt=expand_format_string(event.fmt, event.name + " "), args=event.args.rust_call_varargs()) + +def generate_rs_backend_dstate(event, group): + out(' unsafe { (bindings::qemu_loglevel & bindings::LOG_TRACE)!= 0
Quoted 7 lines
&& '
scripts/tracetool/backend/log.py +3
-0+ + 'trace_event_state_is_enabled(_%(event_id)s_DSTATE) } ||', + event_id = 'TRACE_' + e.name.upper()) +Paolo
With regards,
Daniel
--|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Re: [PATCH 16/20] trace: include qemu_loglevel_mask(LOG_TRACE) in guard
Quoted 11 lines · Paolo Bonzini
Il ven 2 ott 2026, 13:04 Daniel P. Berrangé <[email protected]> ha scritto:
Quoted 8 lines · Paolo Bonzini
Quoted 7 lines · Daniel P. Berrangé
Quoted 6 lines
If emitting a trace event requires computation for the parameters passed to the probe, the callers should guard that computation with
trace_event_by_state_backends(), which is a macro expanding to the a check of the "TRACE_...._DSTATE()" expression. For the log backend this should include a check forLOG_TRACEbeing present in the configured log level.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
This also needs something for Rust (apologies for the mailer damage):
Ok, I'll test that and include it in a future v3, since I already sent out v2 before seeing this.
No hurry, it's just an optimization.
Trying your suggested patch exposed an existing bug in the code, where we did not merge the checks in the C code, and this was only apparent once removing the CHECK_TRACE_EVENT_GET_STATE flag. So I've fixed this all in the v3 posting.
Quoted 37 lines
Paolo
Quoted 34 lines
---
a/scripts/tracetool/backend/log.pyQuoted 10 lines
+++
b/scripts/tracetool/backend/log.pyscripts/tracetool/backend/log.py +0
-1@@ -16,7 +16,6 @@ PUBLIC = True -CHECK_TRACE_EVENT_GET_STATE = True def generate_h_begin(events, group):scripts/tracetool/backend/log.py def generate_rs(event, group): · line 56
Quoted 6 lines
scripts/tracetool/backend/log.py +3
-0@@ -52,3 +51,9 @@ def generate_rs(event, group): ' }', fmt=expand_format_string(event.fmt, event.name + " "), args=event.args.rust_call_varargs()) + +def generate_rs_backend_dstate(event, group): + out(' unsafe { (bindings::qemu_loglevel & bindings::LOG_TRACE)!= 0
Quoted 7 lines
&& '
scripts/tracetool/backend/log.py +3
-0+ + 'trace_event_state_is_enabled(_%(event_id)s_DSTATE) } ||', + event_id = 'TRACE_' + e.name.upper()) +Paolo
With regards,
Daniel
--|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
PATCH 17/20 trace: remove "disable" property from trace files
In reply to Daniel P. BerrangéThe scenarios are not significant enough to justify its use
--- hw/display/trace-events | 2 +- target/hppa/trace-events | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-)
hw/display/trace-events +1 -1
@@ -60,7 +60,7 @@ virtio_gpu_dec_inflight_fences(uint32_t inflight) "in-flight- %u" virtio_gpu_cmd_suspended(uint32_t cmd) "cmd 0x%x" # qxl.c -disable qxl_io_write_vga(int qid, const char *mode, uint32_t addr, uint32_t val) "%d %s addr=%u val=%u" +qxl_io_write_vga(int qid, const char *mode, uint32_t addr, uint32_t val) "%d %s addr=%u val=%u" qxl_create_guest_primary(int qid, uint32_t width, uint32_t height, uint64_t mem, uint32_t format, uint32_t position) "%d %ux%u mem=0x%" PRIx64 " %u,%u" qxl_create_guest_primary_rest(int qid, int32_t stride, uint32_t type, uint32_t flags) "%d %d,%d,%d" qxl_destroy_primary(int qid) "%d"
target/hppa/trace-events +14 -14
@@ -1,19 +1,19 @@ # See docs/devel/tracing.rst for syntax documentation. # mem_helper.c -disable hppa_tlb_flush_ent(void *env, void *ent, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64 -disable hppa_tlb_find_entry(void *env, void *ent, int valid, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p valid=%d va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64 -disable hppa_tlb_find_entry_not_found(void *env, uint64_t addr) "env=%p addr=%08lx" -disable hppa_tlb_get_physical_address(void *env, int ret, int prot, uint64_t addr, uint64_t phys) "env=%p ret=%d prot=%d addr=0x%lx phys=0x%lx" -disable hppa_tlb_fill_excp(void *env, uint64_t addr, int size, int type, int mmu_idx) "env=%p addr=0x%lx size=%d type=%d mmu_idx=%d" -disable hppa_tlb_fill_success(void *env, uint64_t addr, uint64_t phys, int size, int type, int mmu_idx) "env=%p addr=0x%lx phys=0x%lx size=%d type=%d mmu_idx=%d" -disable hppa_tlb_itlba(void *env, void *ent, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64 -disable hppa_tlb_itlbp(void *env, void *ent, int access_id, int u, int pl2, int pl1, int type, int b, int d, int t) "env=%p ent=%p access_id=%x u=%d pl2=%d pl1=%d type=%d b=%d d=%d t=%d" -disable hppa_tlb_ptlb(void *env) "env=%p" -disable hppa_tlb_ptlb_local(void *env) "env=%p" -disable hppa_tlb_ptlbe(void *env) "env=%p" -disable hppa_tlb_lpa_success(void *env, uint64_t addr, uint64_t phys) "env=%p addr=0x%lx phys=0x%lx" -disable hppa_tlb_lpa_failed(void *env, uint64_t addr) "env=%p addr=0x%lx" +hppa_tlb_flush_ent(void *env, void *ent, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64 +hppa_tlb_find_entry(void *env, void *ent, int valid, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p valid=%d va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64 +hppa_tlb_find_entry_not_found(void *env, uint64_t addr) "env=%p addr=%08lx" +hppa_tlb_get_physical_address(void *env, int ret, int prot, uint64_t addr, uint64_t phys) "env=%p ret=%d prot=%d addr=0x%lx phys=0x%lx" +hppa_tlb_fill_excp(void *env, uint64_t addr, int size, int type, int mmu_idx) "env=%p addr=0x%lx size=%d type=%d mmu_idx=%d" +hppa_tlb_fill_success(void *env, uint64_t addr, uint64_t phys, int size, int type, int mmu_idx) "env=%p addr=0x%lx phys=0x%lx size=%d type=%d mmu_idx=%d" +hppa_tlb_itlba(void *env, void *ent, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64 +hppa_tlb_itlbp(void *env, void *ent, int access_id, int u, int pl2, int pl1, int type, int b, int d, int t) "env=%p ent=%p access_id=%x u=%d pl2=%d pl1=%d type=%d b=%d d=%d t=%d" +hppa_tlb_ptlb(void *env) "env=%p" +hppa_tlb_ptlb_local(void *env) "env=%p" +hppa_tlb_ptlbe(void *env) "env=%p" +hppa_tlb_lpa_success(void *env, uint64_t addr, uint64_t phys) "env=%p addr=0x%lx phys=0x%lx" +hppa_tlb_lpa_failed(void *env, uint64_t addr) "env=%p addr=0x%lx" # op_helper.c -disable hppa_tlb_probe(uint64_t addr, int level, int want) "addr=0x%lx level=%d want=%d" +hppa_tlb_probe(uint64_t addr, int level, int want) "addr=0x%lx level=%d want=%d"
Signature · 1 line
2.55.0
PATCH 18/20 trace: stop tracking static disabled state
In reply to Daniel P. BerrangéThe TraceEvent struct contains a "bool sstate" field which track whether a trace event was disabled statically. i.e. at build time via the "disable" property annotation in trace-events.
The only runtime use of this field is to let "trace-event-get-state" report that an event is "unavailable" instead of reporting an error for an unknown trace event.
Trace events are not ABI so their names can change and the event can come and go at any time. Thus there is little utility in reporting the existence of a disabled event that cannot ever be used at runtime.
Removing the "bool sstate" field from TraceEvent saves 8 bytes of space in the struct, adding up to approx 64 KB across all current events.
--- qapi/trace.json | 5 ++-- scripts/tracetool/format/c.py | 2 -- scripts/tracetool/format/h.py | 8 ------ stubs/trace-control.c | 1 - tests/tracetool/all.c | 2 -- tests/tracetool/all.h | 14 +++++------ tests/tracetool/dtrace.c | 2 -- tests/tracetool/dtrace.h | 2 -- tests/tracetool/ftrace.c | 2 -- tests/tracetool/ftrace.h | 6 ++--- tests/tracetool/log.c | 2 -- tests/tracetool/log.h | 6 ++--- tests/tracetool/nop.h | 2 -- tests/tracetool/simple.c | 2 -- tests/tracetool/simple.h | 2 -- tests/tracetool/syslog.c | 2 -- tests/tracetool/syslog.h | 6 ++--- tests/tracetool/ust.c | 2 -- tests/tracetool/ust.h | 2 -- trace/control-internal.h | 6 ----- trace/control-target.c | 2 -- trace/control.c | 9 ------- trace/control.h | 18 +++----------- trace/event-internal.h | 2 -- trace/qmp.c | 47 ++++++++++------------------------- 25 files changed, 30 insertions(+), 124 deletions(-)
qapi/trace.json +2 -3
@@ -17,8 +17,6 @@ # # State of a tracing event. # -# @unavailable: The event is statically disabled. -# # @disabled: The event is dynamically disabled. # # @enabled: The event is dynamically enabled.
@@ -26,7 +24,7 @@ # Since: 2.2 ## { 'enum': 'TraceEventState', - 'data': ['unavailable', 'disabled', 'enabled'] } + 'data': ['disabled', 'enabled'] } ## # @TraceEventInfo:
@@ -73,6 +71,7 @@ # @enable: Whether to enable tracing. # # @ignore-unavailable: Do not match unavailable events with @name. +# Deprecated: since 11.2 # # Since: 2.2 #
scripts/tracetool/format/c.py +0 -2
@@ -39,12 +39,10 @@ def generate(events, backend, group): ' .id = 0,', '#endif', ' .name = \"%(name)s\",', - ' .sstate = %(sstate)s,', ' .dstate = &%(dstate)s', '};', event = e.api(e.QEMU_EVENT), name = e.name, - sstate = "TRACE_%s_ENABLED" % e.name.upper(), dstate = e.api(e.QEMU_DSTATE)) out('TraceEvent *%(group)s_trace_events[] = {',
scripts/tracetool/format/h.py +0 -8
@@ -38,14 +38,6 @@ def generate(events, backend, group): for e in events: out('#define %s 0' % e.api(e.QEMU_DSTATE)) - # static state - for e in events: - if 'disable' in e.properties: - enabled = 0 - else: - enabled = 1 - out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled)) - backend.generate_begin(events, group) for e in events:
stubs/trace-control.c +0 -1
@@ -14,7 +14,6 @@void trace_event_set_state_dynamic (TraceEvent *ev,bool state) {bool state_pre; -assert (trace_event_get_state_static (ev));/* * We ignore the "vcpu" property here, since there's no target code. Then
tests/tracetool/all.c +0 -2
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {
tests/tracetool/all.h +6 -8
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#ifndef SDT_USE_VARIADIC #define SDT_USE_VARIADIC 1#endif
@@ -59,16 +57,16 @@ static inline void trace_test_blah(void *context, const char *filename)if (trace_event_get_state (TRACE_TEST_BLAH )) {#line 4 "trace-events"ftrace_write ("test_blah " "Blah context=%p filename=%s" "\n" , context, filename); -#line 62 "all.h" +#line 60 "all.h"if (qemu_loglevel_mask (LOG_TRACE )) {#line 4 "trace-events"qemu_log ("test_blah " "Blah context=%p filename=%s" "\n" , context, filename); -#line 66 "all.h" +#line 64 "all.h" }_simple_trace_test_blah (context, filename);#line 4 "trace-events"syslog (LOG_INFO ,"test_blah " "Blah context=%p filename=%s" , context, filename); -#line 71 "all.h" +#line 69 "all.h" } }
@@ -89,16 +87,16 @@ static inline void trace_test_wibble(void *context, int value)if (trace_event_get_state (TRACE_TEST_WIBBLE )) {#line 5 "trace-events"ftrace_write ("test_wibble " "Wibble context=%p value=%d" "\n" , context, value); -#line 91 "all.h" +#line 89 "all.h"if (qemu_loglevel_mask (LOG_TRACE )) {#line 5 "trace-events"qemu_log ("test_wibble " "Wibble context=%p value=%d" "\n" , context, value); -#line 95 "all.h" +#line 93 "all.h" }_simple_trace_test_wibble (context, value);#line 5 "trace-events"syslog (LOG_INFO ,"test_wibble " "Wibble context=%p value=%d" , context, value); -#line 100 "all.h" +#line 98 "all.h" } }#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
tests/tracetool/dtrace.c +0 -2
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {
tests/tracetool/dtrace.h +0 -2
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#ifndef SDT_USE_VARIADIC #define SDT_USE_VARIADIC 1#endif
tests/tracetool/ftrace.c +0 -2
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {
tests/tracetool/ftrace.h +2 -4
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#include "trace/ftrace.h"
@@ -24,7 +22,7 @@ static inline void trace_test_blah(void *context, const char *filename)if (trace_event_get_state (TRACE_TEST_BLAH )) {#line 4 "trace-events"ftrace_write ("test_blah " "Blah context=%p filename=%s" "\n" , context, filename); -#line 28 "ftrace.h" +#line 26 "ftrace.h" } }
@@ -37,7 +35,7 @@ static inline void trace_test_wibble(void *context, int value)if (trace_event_get_state (TRACE_TEST_WIBBLE )) {#line 5 "trace-events"ftrace_write ("test_wibble " "Wibble context=%p value=%d" "\n" , context, value); -#line 41 "ftrace.h" +#line 39 "ftrace.h" } }#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
tests/tracetool/log.c +0 -2
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {
tests/tracetool/log.h +2 -4
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#include "qemu/log-for-trace.h"
@@ -26,7 +24,7 @@ static inline void trace_test_blah(void *context, const char *filename)if (qemu_loglevel_mask (LOG_TRACE )) {#line 4 "trace-events"qemu_log ("test_blah " "Blah context=%p filename=%s" "\n" , context, filename); -#line 29 "log.h" +#line 27 "log.h" } } }
@@ -42,7 +40,7 @@ static inline void trace_test_wibble(void *context, int value)if (qemu_loglevel_mask (LOG_TRACE )) {#line 5 "trace-events"qemu_log ("test_wibble " "Wibble context=%p value=%d" "\n" , context, value); -#line 44 "log.h" +#line 42 "log.h" } } }
tests/tracetool/nop.h +0 -2
@@ -8,8 +8,6 @@#define _TRACE_TEST_BLAH_DSTATE 0#define _TRACE_TEST_WIBBLE_DSTATE 0 -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#define TRACE_TEST_BLAH_BACKEND_DSTATE () ( \ false)
tests/tracetool/simple.c +0 -2
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {
tests/tracetool/simple.h +0 -2
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1void _simple_trace_test_blah (void *context,const char *filename);void _simple_trace_test_wibble (void *context,int value);
tests/tracetool/syslog.c +0 -2
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {
tests/tracetool/syslog.h +2 -4
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#include <syslog.h>
@@ -24,7 +22,7 @@ static inline void trace_test_blah(void *context, const char *filename)if (trace_event_get_state (TRACE_TEST_BLAH )) {#line 4 "trace-events"syslog (LOG_INFO ,"test_blah " "Blah context=%p filename=%s" , context, filename); -#line 28 "syslog.h" +#line 26 "syslog.h" } }
@@ -37,7 +35,7 @@ static inline void trace_test_wibble(void *context, int value)if (trace_event_get_state (TRACE_TEST_WIBBLE )) {#line 5 "trace-events"syslog (LOG_INFO ,"test_wibble " "Wibble context=%p value=%d" , context, value); -#line 41 "syslog.h" +#line 39 "syslog.h" } }#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
tests/tracetool/ust.c +0 -2
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {
tests/tracetool/ust.h +0 -2
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#include <lttng/tracepoint.h> #include "trace-ust-testsuite.h"
trace/control-internal.h +0 -6
@@ -33,12 +33,6 @@ static inline const char * trace_event_get_name(TraceEvent *ev)return ev->name; } -static inline bool trace_event_get_state_static (TraceEvent *ev) -{ -assert (ev !=NULL ); -return ev->sstate; -} -/* it's on fast path, avoid consistency checks (asserts) */ #define trace_event_get_state_dynamic_by_id (id) \ (unlikely(trace_events_enabled_count) && _ ## id ## _DSTATE)
trace/control-target.c +0 -2
@@ -12,8 +12,6 @@void trace_event_set_state_dynamic (TraceEvent *ev,bool state) { -assert (trace_event_get_state_static (ev)); -bool state_pre = *ev->dstate;if (state_pre != state) {if (state) {
trace/control.c +0 -9
@@ -167,15 +167,6 @@ static void do_trace_enable_events(const char *line_buf)trace_event_iter_init_pattern (&iter, line_ptr);while ((ev =trace_event_iter_next (&iter)) !=NULL ) { -if (!trace_event_get_state_static (ev)) { -if (!is_pattern) { -warn_report ("trace event '%s' is not traceable" , - line_ptr); -return ; - } -continue ; - } -/* start tracing */ trace_event_set_state_dynamic (ev, enable);if (!is_pattern) {
trace/control.h +3 -15
@@ -107,13 +107,13 @@ static const char * trace_event_get_name(TraceEvent *ev);* impact. */ #define trace_event_get_state (id) \ - ((id ##_ENABLED) && trace_event_get_state_dynamic_by_id(id)) + (trace_event_get_state_dynamic_by_id(id))/** * trace_event_get_state_backends: * @id: Event identifier name. * -* Get the tracing state of an event, both static and dynamic state from all +* Get the tracing state of an event from all * compiled-in backends. * * If the event has the disabled property, the check will have no performance
@@ -123,18 +123,7 @@ static const char * trace_event_get_name(TraceEvent *ev);* does not have the disabled property. */ #define trace_event_get_state_backends (id) \ - ((id ##_ENABLED) && id ##_BACKEND_DSTATE()) - -/** -* trace_event_get_state_static: -* @id: Event identifier. -* -* Get the static tracing state of an event. -* -* Use the define 'TRACE_${EVENT_NAME}_ENABLED' for compile-time checks (it will -* be set to 1 or 0 according to the presence of the disabled property). -*/ -static bool trace_event_get_state_static (TraceEvent *ev); + (id ##_BACKEND_DSTATE())/** * trace_event_get_state_dynamic:
@@ -148,7 +137,6 @@ static bool trace_event_get_state_dynamic(TraceEvent *ev);* * Set the dynamic tracing state of an event. * -* Pre-condition: trace_event_get_state_static(ev) == true */ void trace_event_set_state_dynamic (TraceEvent *ev,bool state);
trace/event-internal.h +0 -2
@@ -14,7 +14,6 @@* TraceEvent: * @id: Unique event identifier. * @name: Event name. -* @sstate: Static tracing state. * @dstate: Dynamic tracing state * * Opaque generic description of a tracing event.
@@ -24,7 +23,6 @@ typedef struct TraceEvent {uint32_t id;#endif const char * name; -const bool sstate;uint8_t *dstate; } TraceEvent;
trace/qmp.c +13 -34
88 lines not on this page · raw message
Signature · 1 line
2.55.0
Re: [PATCH 18/20] trace: stop tracking static disabled state
Quoted 12 lines
The TraceEvent struct contains a "bool sstate" field which track whether a trace event was disabled statically. i.e. at build time via the "disable" property annotation in trace-events.
The only runtime use of this field is to let "trace-event-get-state" report that an event is "unavailable" instead of reporting an error for an unknown trace event.
Trace events are not ABI so their names can change and the event can come and go at any time. Thus there is little utility in reporting the existence of a disabled event that cannot ever be used at runtime.
Quoted 6 lines
Removing the "bool sstate" field from TraceEvent saves 8 bytes of space in the struct, adding up to approx 64 KB across all current events.
Signed-off-by Daniel P. Berrangé <[email protected]>Message-ID: <[email protected]>
Need a tracing.rst documentation update too.
Quoted 490 lines
qapi/trace.json +1
-3@@ -17,8 +17,6 @@ # # State of a tracing event. # -# @unavailable: The event is statically disabled. -# # @disabled: The event is dynamically disabled. # # @enabled: The event is dynamically enabled.@@ -26,7 +24,7 @@ # Since: 2.2 ## { 'enum': 'TraceEventState', - 'data': ['unavailable', 'disabled', 'enabled'] } + 'data': ['disabled', 'enabled'] } ### @TraceEventInfo:
qapi/trace.json +1
-0@@ -73,6 +71,7 @@ # @enable: Whether to enable tracing. # # @ignore-unavailable: Do not match unavailable events with @name. +# Deprecated: since 11.2 # # Since: 2.2 #scripts/tracetool/format/c.py +0
-2@@ -39,12 +39,10 @@ def generate(events, backend, group): ' .id = 0,', '#endif', ' .name = \"%(name)s\",', - ' .sstate = %(sstate)s,', ' .dstate = &%(dstate)s', '};', event = e.api(e.QEMU_EVENT), name = e.name, - sstate = "TRACE_%s_ENABLED" % e.name.upper(), dstate = e.api(e.QEMU_DSTATE)) out('TraceEvent *%(group)s_trace_events[] = {',scripts/tracetool/format/h.py +0
-8@@ -38,14 +38,6 @@ def generate(events, backend, group): for e in events: out('#define %s 0' % e.api(e.QEMU_DSTATE)) - # static state - for e in events: - if 'disable' in e.properties: - enabled = 0 - else: - enabled = 1 - out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled)) - backend.generate_begin(events, group) for e in events:stubs/trace-control.c +0
-1@@ -14,7 +14,6 @@void trace_event_set_state_dynamic (TraceEvent *ev,bool state) {bool state_pre; -assert (trace_event_get_state_static (ev));/* * We ignore the "vcpu" property here, since there's no target code. Then tests/tracetool/all.c +0
-2@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {tests/tracetool/all.h +6
-8@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#ifndef SDT_USE_VARIADIC #define SDT_USE_VARIADIC 1#endif @@ -59,16 +57,16 @@ static inline void trace_test_blah(void *context, const char *filename)if (trace_event_get_state (TRACE_TEST_BLAH )) {#line 4 "trace-events"ftrace_write ("test_blah " "Blah context=%p filename=%s" "\n" , context, filename); -#line 62 "all.h" +#line 60 "all.h"if (qemu_loglevel_mask (LOG_TRACE )) {#line 4 "trace-events"qemu_log ("test_blah " "Blah context=%p filename=%s" "\n" , context, filename); -#line 66 "all.h" +#line 64 "all.h" }_simple_trace_test_blah (context, filename);#line 4 "trace-events"syslog (LOG_INFO ,"test_blah " "Blah context=%p filename=%s" , context, filename); -#line 71 "all.h" +#line 69 "all.h" } }@@ -89,16 +87,16 @@ static inline void trace_test_wibble(void *context, int value)if (trace_event_get_state (TRACE_TEST_WIBBLE )) {#line 5 "trace-events"ftrace_write ("test_wibble " "Wibble context=%p value=%d" "\n" , context, value); -#line 91 "all.h" +#line 89 "all.h"if (qemu_loglevel_mask (LOG_TRACE )) {#line 5 "trace-events"qemu_log ("test_wibble " "Wibble context=%p value=%d" "\n" , context, value); -#line 95 "all.h" +#line 93 "all.h" }_simple_trace_test_wibble (context, value);#line 5 "trace-events"syslog (LOG_INFO ,"test_wibble " "Wibble context=%p value=%d" , context, value); -#line 100 "all.h" +#line 98 "all.h" } }#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */ tests/tracetool/dtrace.c +0
-2@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {tests/tracetool/dtrace.h +0
-2@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#ifndef SDT_USE_VARIADIC #define SDT_USE_VARIADIC 1#endif tests/tracetool/ftrace.c +0
-2@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {tests/tracetool/ftrace.h +2
-4@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#include "trace/ftrace.h" @@ -24,7 +22,7 @@ static inline void trace_test_blah(void *context, const char *filename)if (trace_event_get_state (TRACE_TEST_BLAH )) {#line 4 "trace-events"ftrace_write ("test_blah " "Blah context=%p filename=%s" "\n" , context, filename); -#line 28 "ftrace.h" +#line 26 "ftrace.h" } }@@ -37,7 +35,7 @@ static inline void trace_test_wibble(void *context, int value)if (trace_event_get_state (TRACE_TEST_WIBBLE )) {#line 5 "trace-events"ftrace_write ("test_wibble " "Wibble context=%p value=%d" "\n" , context, value); -#line 41 "ftrace.h" +#line 39 "ftrace.h" } }#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */ tests/tracetool/log.c +0
-2@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {tests/tracetool/log.h +2
-4@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#include "qemu/log-for-trace.h" @@ -26,7 +24,7 @@ static inline void trace_test_blah(void *context, const char *filename)if (qemu_loglevel_mask (LOG_TRACE )) {#line 4 "trace-events"qemu_log ("test_blah " "Blah context=%p filename=%s" "\n" , context, filename); -#line 29 "log.h" +#line 27 "log.h" } } }@@ -42,7 +40,7 @@ static inline void trace_test_wibble(void *context, int value)if (qemu_loglevel_mask (LOG_TRACE )) {#line 5 "trace-events"qemu_log ("test_wibble " "Wibble context=%p value=%d" "\n" , context, value); -#line 44 "log.h" +#line 42 "log.h" } } }tests/tracetool/nop.h +0
-2@@ -8,8 +8,6 @@#define _TRACE_TEST_BLAH_DSTATE 0#define _TRACE_TEST_WIBBLE_DSTATE 0 -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#define TRACE_TEST_BLAH_BACKEND_DSTATE () ( \ false)tests/tracetool/simple.c +0
-2@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {tests/tracetool/simple.h +0
-2@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1void _simple_trace_test_blah (void *context,const char *filename);void _simple_trace_test_wibble (void *context,int value);tests/tracetool/syslog.c +0
-2@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {tests/tracetool/syslog.h +2
-4@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#include <syslog.h> @@ -24,7 +22,7 @@ static inline void trace_test_blah(void *context, const char *filename)if (trace_event_get_state (TRACE_TEST_BLAH )) {#line 4 "trace-events"syslog (LOG_INFO ,"test_blah " "Blah context=%p filename=%s" , context, filename); -#line 28 "syslog.h" +#line 26 "syslog.h" } }@@ -37,7 +35,7 @@ static inline void trace_test_wibble(void *context, int value)if (trace_event_get_state (TRACE_TEST_WIBBLE )) {#line 5 "trace-events"syslog (LOG_INFO ,"test_wibble " "Wibble context=%p value=%d" , context, value); -#line 41 "syslog.h" +#line 39 "syslog.h" } }#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */ tests/tracetool/ust.c +0
-2@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = { .id = 0, #endif .name = "test_blah", - .sstate = TRACE_TEST_BLAH_ENABLED, .dstate = &_TRACE_TEST_BLAH_DSTATE }; TraceEvent _TRACE_TEST_WIBBLE_EVENT = {@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = { .id = 0, #endif .name = "test_wibble", - .sstate = TRACE_TEST_WIBBLE_ENABLED, .dstate = &_TRACE_TEST_WIBBLE_DSTATE }; TraceEvent *testsuite_trace_events[] = {tests/tracetool/ust.h +0
-2@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;extern uint8_t _TRACE_TEST_BLAH_DSTATE;extern uint8_t _TRACE_TEST_WIBBLE_DSTATE; -#define TRACE_TEST_BLAH_ENABLED 1 -#define TRACE_TEST_WIBBLE_ENABLED 1#include <lttng/tracepoint.h> #include "trace-ust-testsuite.h" trace/control-internal.h +0
-6@@ -33,12 +33,6 @@ static inline const char * trace_event_get_name(TraceEvent *ev)return ev->name; } -static inline bool trace_event_get_state_static (TraceEvent *ev) -{ -assert (ev !=NULL ); -return ev->sstate; -} -/* it's on fast path, avoid consistency checks (asserts) */ #define trace_event_get_state_dynamic_by_id (id) \ (unlikely(trace_events_enabled_count) && _ ## id ## _DSTATE)trace/control-target.c +0
-2@@ -12,8 +12,6 @@void trace_event_set_state_dynamic (TraceEvent *ev,bool state) { -assert (trace_event_get_state_static (ev)); -bool state_pre = *ev->dstate;if (state_pre != state) {if (state) {trace/control.c +0
-9@@ -167,15 +167,6 @@ static void do_trace_enable_events(const char *line_buf)trace_event_iter_init_pattern (&iter, line_ptr);while ((ev =trace_event_iter_next (&iter)) !=NULL ) { -if (!trace_event_get_state_static (ev)) { -if (!is_pattern) { -warn_report ("trace event '%s' is not traceable" , - line_ptr); -return ; - } -continue ; - } -/* start tracing */ trace_event_set_state_dynamic (ev, enable);if (!is_pattern) {trace/control.h +2
-2@@ -107,13 +107,13 @@ static const char * trace_event_get_name(TraceEvent *ev);* impact. */ #define trace_event_get_state (id) \ - ((id ##_ENABLED) && trace_event_get_state_dynamic_by_id(id)) + (trace_event_get_state_dynamic_by_id(id))/** * trace_event_get_state_backends: * @id: Event identifier name. * -* Get the tracing state of an event, both static and dynamic state from all +* Get the tracing state of an event from all * compiled-in backends. * * If the event has the disabled property, the check will have no performance
trace/control.h static const char * trace_event_get_name(TraceEvent *ev); · line 124
Quoted 2 lines
trace/control.h +0
-0@@ -123,18 +123,7 @@ static const char * trace_event_get_name(TraceEvent *ev);* does not have the disabled property. */
It should also drop the mention of "disabled property"
Quoted 132 lines
trace/control.h +1
-13#define trace_event_get_state_backends (id) \ - ((id ##_ENABLED) && id ##_BACKEND_DSTATE()) - -/** -* trace_event_get_state_static: -* @id: Event identifier. -* -* Get the static tracing state of an event. -* -* Use the define 'TRACE_${EVENT_NAME}_ENABLED' for compile-time checks (it will -* be set to 1 or 0 according to the presence of the disabled property). -*/ -static bool trace_event_get_state_static (TraceEvent *ev); + (id ##_BACKEND_DSTATE())/** * trace_event_get_state_dynamic: @@ -148,7 +137,6 @@ static bool trace_event_get_state_dynamic(TraceEvent *ev);* * Set the dynamic tracing state of an event. * -* Pre-condition: trace_event_get_state_static(ev) == true */ void trace_event_set_state_dynamic (TraceEvent *ev,bool state);trace/event-internal.h +0
-2@@ -14,7 +14,6 @@* TraceEvent: * @id: Unique event identifier. * @name: Event name. -* @sstate: Static tracing state. * @dstate: Dynamic tracing state * * Opaque generic description of a tracing event. @@ -24,7 +23,6 @@ typedef struct TraceEvent {uint32_t id;#endif const char * name; -const bool sstate;uint8_t *dstate; } TraceEvent;trace/qmp.c +13
-31@@ -11,9 +11,10 @@#include "qapi/error.h" #include "qapi/qapi-commands-trace.h" #include "control.h" +#include "qemu/error-report.h" -static bool check_events (bool ignore_unavailable,bool is_pattern, +static bool check_events (bool is_pattern,const char *name,Error **errp) {if (!is_pattern) {@@ -24,27 +25,8 @@ static bool check_events(bool ignore_unavailable, bool is_pattern,error_setg (errp,"unknown event \"%s\"" , name);return false; } - -/* error for unavailable event */ -if (!ignore_unavailable && !trace_event_get_state_static (ev)) { -error_setg (errp,"event \"%s\" is disabled" , name); -return false; - } - -return true; - }else { -/* error for unavailable events */ -TraceEventIter iter; -TraceEvent *ev; -trace_event_iter_init_pattern (&iter, name); -while ((ev =trace_event_iter_next (&iter)) !=NULL ) { -if (!ignore_unavailable && !trace_event_get_state_static (ev)) { -error_setg (errp,"event \"%s\" is disabled" ,trace_event_get_name (ev)); -return false; - } - } -return true; } +return true; } TraceEventInfoList *qmp_trace_event_get_state(const char *name,@@ -56,7 +38,7 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name,bool is_pattern =trace_event_is_pattern (name);/* Check events */ -if (!check_events (true, is_pattern, name, errp)) { +if (!check_events (is_pattern, name, errp)) {return NULL ; }@@ -68,14 +50,10 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name, value =g_new (TraceEventInfo,1 ); value->name =g_strdup (trace_event_get_name (ev)); -if (!trace_event_get_state_static (ev)) { - value->state =TRACE_EVENT_STATE_UNAVAILABLE ; +if (trace_event_get_state_dynamic (ev)) { + value->state =TRACE_EVENT_STATE_ENABLED ; }else { -if (trace_event_get_state_dynamic (ev)) { - value->state =TRACE_EVENT_STATE_ENABLED ; - }else { - value->state =TRACE_EVENT_STATE_DISABLED ; - } + value->state =TRACE_EVENT_STATE_DISABLED ; }QAPI_LIST_PREPEND (events, value); }@@ -91,18 +69,19 @@ void qmp_trace_event_set_state(const char *name, bool enable,TraceEvent *ev;bool is_pattern =trace_event_is_pattern (name); +if (has_ignore_unavailable && ignore_unavailable) { +warn_report_once ("the 'ignore-unavailable' property is deprecated " +"and has no effect" ); + } +/* Check events */ -if (!check_events (has_ignore_unavailable && ignore_unavailable, - is_pattern, name, errp)) { +if (!check_events (is_pattern, name, errp)) {return ; }
trace/qmp.c void qmp_trace_event_set_state(const char *name, bool enable, · line 87
Quoted 10 lines
trace/qmp.c +0
-3/* Apply changes (all errors checked above) */ trace_event_iter_init_pattern (&iter, name);while ((ev =trace_event_iter_next (&iter)) !=NULL ) { -if (!trace_event_get_state_static (ev)) { -continue ; - }trace_event_set_state_dynamic (ev, enable); } }
Signature · 1 line
Marc-André Lureau <[email protected]>
Re: [PATCH 18/20] trace: stop tracking static disabled state
Quoted 12 lines · On Thu, Oct 01, 2026 at 11:14:36PM +0400, [email protected] wrote:
Quoted 12 lines
The TraceEvent struct contains a "bool sstate" field which track whether a trace event was disabled statically. i.e. at build time via the "disable" property annotation in trace-events.
The only runtime use of this field is to let "trace-event-get-state" report that an event is "unavailable" instead of reporting an error for an unknown trace event.
Trace events are not ABI so their names can change and the event can come and go at any time. Thus there is little utility in reporting the existence of a disabled event that cannot ever be used at runtime.
Quoted 8 lines
Quoted 6 lines
Removing the "bool sstate" field from TraceEvent saves 8 bytes of space in the struct, adding up to approx 64 KB across all current events.
Signed-off-by Daniel P. Berrangé <[email protected]>Message-ID: <[email protected]>
Need a
tracing.rstdocumentation update too.
I'll do that docs in the next patch, since that is the one that actually removes the functional part of the feature.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
PATCH 19/20 trace: remove parsing of "disable" event property
In reply to Daniel P. BerrangéFinish the removal of the "disable" event property by removing code that parses properties and the backend code generators.
This "fixes" a bug in the UST backends which looked for a property called "disabled" instead of "disable".
--- scripts/tracetool/__init__.py | 27 +++++--------------- scripts/tracetool/backend/dtrace.py | 2 -- scripts/tracetool/format/c.py | 9 +++---- scripts/tracetool/format/d.py | 3 --- scripts/tracetool/format/h.py | 20 +++++++-------- scripts/tracetool/format/log_stap.py | 3 --- scripts/tracetool/format/rs.py | 26 +++++++++---------- scripts/tracetool/format/simpletrace_stap.py | 3 --- scripts/tracetool/format/stap.py | 3 --- scripts/tracetool/format/ust_events_c.py | 3 --- scripts/tracetool/format/ust_events_h.py | 3 --- 11 files changed, 30 insertions(+), 72 deletions(-)
scripts/tracetool/__init__.py +6 -21
@@ -362,8 +362,6 @@ class Event(object): The event name. fmt : str The event format string. - properties : set(str) - Properties of the event. args : Arguments The event arguments. lineno : int
@@ -373,23 +371,18 @@ class Event(object): """ - _CRE = re.compile(r"((?P<props>[\w\s]+)\s+)?" - r"(?P<name>\w+)" + _CRE = re.compile(r"(?P<name>\w+)" r"\((?P<args>[^)]*)\)" r"\s*" r"(?P<fmt>\".+)?" r"\s*") - _VALID_PROPS = set(["disable"]) - - def __init__(self, name, props, fmt, args, lineno, filename): + def __init__(self, name, fmt, args, lineno, filename): """ Parameters ---------- name : string Event name. - props : list of str - Property names. fmt : str Event printing format string. args : Arguments
@@ -401,7 +394,6 @@ def __init__(self, name, props, fmt, args, lineno, filename): """ self.name = name - self.properties = props self.fmt = fmt self.args = args self.lineno = int(lineno)
@@ -411,11 +403,6 @@ def __init__(self, name, props, fmt, args, lineno, filename): raise ValueError("Event '%s' has more than maximum permitted " "argument count" % name) - unknown_props = set(self.properties) - self._VALID_PROPS - if len(unknown_props) > 0: - raise ValueError("Unknown properties: %s" - % ", ".join(unknown_props)) - @staticmethod def build(line_str, lineno, filename):
@@ -435,7 +422,6 @@ def build(line_str, lineno, filename): groups = m.groupdict('') name = groups["name"] - props = groups["props"].split() fmt = groups["fmt"] if fmt.find("%m") != -1: raise ValueError("Event format '%m' is forbidden, pass the error "
@@ -448,14 +434,13 @@ def build(line_str, lineno, filename): args = Arguments.build(groups["args"]) - return Event(name, props, fmt, args, lineno, posix_relpath(filename)) + return Event(name, fmt, args, lineno, posix_relpath(filename)) def __repr__(self): """Evaluable string representation for this object.""" - return "Event('%s %s(%s) %s')" % (" ".join(self.properties), - self.name, - self.args, - self.fmt) + return "Event('%s(%s) %s')" % (self.name, + self.args, + self.fmt) # Star matching on PRI is dangerous as one might have multiple # arguments with that format, hence the non-greedy version of it. _FMT = re.compile(r"(%[\d\.]*\w+|%.*?PRI\S+)")
scripts/tracetool/backend/dtrace.py +0 -2
@@ -79,8 +79,6 @@ def generate_rs_begin(events, group): # These are the Rust declarations of the .probes section semaphores # generated by dtrace(1) in its .o file output. for e in events: - if 'disable' in e.properties: - continue out(' #[allow(dead_code)]', f' static qemu_{e.name}_semaphore: UnsafeCell<u16>;') out('}',
scripts/tracetool/format/c.py +3 -6
@@ -16,9 +16,6 @@ def generate(events, backend, group): - active_events = [e for e in events - if "disable" not in e.properties] - header = "trace-" + group + ".h" out('/* This file is autogenerated by tracetool, do not edit. */',
@@ -62,7 +59,7 @@ def generate(events, backend, group): 'trace_init(trace_%(group)s_register_events)', group = group.lower()) - backend.generate_begin(active_events, group) - for event in active_events: + backend.generate_begin(events, group) + for event in events: backend.generate(event, group) - backend.generate_end(active_events, group) + backend.generate_end(events, group)
scripts/tracetool/format/d.py +0 -3
@@ -30,9 +30,6 @@ def generate(events, backend, group): - events = [e for e in events - if "disable" not in e.properties] - # SystemTap's dtrace(1) warns about empty "provider qemu {}" but is happy # with an empty file. Avoid the warning. # But dtrace on macOS can't deal with empty files.
scripts/tracetool/format/h.py +9 -11
@@ -46,8 +46,7 @@ def generate(events, backend, group): '#define %(api)s() ( \\', api=e.api(e.QEMU_BACKEND_DSTATE)) - if "disable" not in e.properties: - backend.generate_backend_dstate(e, group) + backend.generate_backend_dstate(e, group) out(' false)')
@@ -57,16 +56,15 @@ def generate(events, backend, group): api=e.api(), args=e.args) - if "disable" not in e.properties: - backend.generate(e, group, check_trace_event_get_state=False) + backend.generate(e, group, check_trace_event_get_state=False) - if backend.check_trace_event_get_state: - event_id = 'TRACE_' + e.name.upper() - cond = "trace_event_get_state(%s)" % event_id - out(' if (%(cond)s) {', - cond=cond) - backend.generate(e, group, check_trace_event_get_state=True) - out(' }') + if backend.check_trace_event_get_state: + event_id = 'TRACE_' + e.name.upper() + cond = "trace_event_get_state(%s)" % event_id + out(' if (%(cond)s) {', + cond=cond) + backend.generate(e, group, check_trace_event_get_state=True) + out(' }') out('}') backend.generate_end(events, group)
scripts/tracetool/format/log_stap.py +0 -3
@@ -90,9 +90,6 @@ def generate(events, backend, group): '') for event_id, e in enumerate(events): - if 'disable' in e.properties: - continue - out('probe %(probeprefix)s.log.%(name)s = %(probeprefix)s.%(name)s ?', '{', probeprefix=probeprefix(),
scripts/tracetool/format/rs.py +12 -14
@@ -52,11 +52,10 @@ def generate(events, backend, group): '{', api=e.api(e.QEMU_RUST_DSTATE)) - if "disable" not in e.properties: - backend.generate_backend_dstate(e, group) - if backend.check_trace_event_get_state: - out(' trace_event_state_is_enabled(unsafe { _%(event_id)s_DSTATE}) ||', - event_id = 'TRACE_' + e.name.upper()) + backend.generate_backend_dstate(e, group) + if backend.check_trace_event_get_state: + out(' trace_event_state_is_enabled(unsafe { _%(event_id)s_DSTATE}) ||', + event_id = 'TRACE_' + e.name.upper()) out(' false', '}',
@@ -68,15 +67,14 @@ def generate(events, backend, group): api=e.api(e.QEMU_TRACE), args=e.args.rust_decl()) - if "disable" not in e.properties: - backend.generate(e, group, check_trace_event_get_state=False) - if backend.check_trace_event_get_state: - event_id = 'TRACE_' + e.name.upper() - out(' if trace_event_state_is_enabled(unsafe { _%(event_id)s_DSTATE}) {', - event_id = event_id, - api=e.api()) - backend.generate(e, group, check_trace_event_get_state=True) - out(' }') + backend.generate(e, group, check_trace_event_get_state=False) + if backend.check_trace_event_get_state: + event_id = 'TRACE_' + e.name.upper() + out(' if trace_event_state_is_enabled(unsafe { _%(event_id)s_DSTATE}) {', + event_id = event_id, + api=e.api()) + backend.generate(e, group, check_trace_event_get_state=True) + out(' }') out('}', '')
scripts/tracetool/format/simpletrace_stap.py +0 -3
@@ -24,9 +24,6 @@ def generate(events, backend, group): '') for event_id, e in enumerate(events): - if 'disable' in e.properties: - continue - out('probe %(probeprefix)s.simpletrace.%(name)s = %(probeprefix)s.%(name)s ?', '{', probeprefix=probeprefix(),
scripts/tracetool/format/stap.py +0 -3
@@ -34,9 +34,6 @@ def stap_escape(identifier): def generate(events, backend, group): - events = [e for e in events - if "disable" not in e.properties] - out('/* This file is autogenerated by tracetool, do not edit. */', '/* SPDX-License-Identifier: GPL-2.0-or-later */', '')
scripts/tracetool/format/ust_events_c.py +0 -3
@@ -16,9 +16,6 @@ def generate(events, backend, group): - events = [e for e in events - if "disabled" not in e.properties] - out('/* This file is autogenerated by tracetool, do not edit. */', '/* SPDX-License-Identifier: GPL-2.0-or-later */', '',
scripts/tracetool/format/ust_events_h.py +0 -3
@@ -16,9 +16,6 @@ def generate(events, backend, group): - events = [e for e in events - if "disabled" not in e.properties] - if group == "all": include = "trace-ust-all.h" else:
Signature · 1 line
2.55.0
PATCH 20/20 trace: remove 'trace_event_get_state' wrapper
In reply to Daniel P. BerrangéThe 'trace_event_get_state' macro is a wrapper around the 'trace_event_get_state_dynamic_by_id' macro, which is a direct check of the _TRACE_...._DSTATE global variable.
The only code that should be using this is the generated trace probes, but the name looks rather appealing causing it to be mistakenly used in other places, instead of the recommended 'trace_event_get_state_dynamic_backends'.
Removing the 'trace_event_get_state' macro reduces the potential for confusion.
--- monitor/qmp.c | 4 ++-- scripts/tracetool/backend/__init__.py | 3 ++- scripts/tracetool/format/h.py | 2 +- tests/tracetool/all.h | 4 ++-- tests/tracetool/ftrace.h | 4 ++-- tests/tracetool/log.h | 4 ++-- tests/tracetool/simple.h | 4 ++-- tests/tracetool/syslog.h | 4 ++-- trace/control.h | 12 ------------ 9 files changed, 15 insertions(+), 26 deletions(-)
monitor/qmp.c +2 -2
@@ -439,7 +439,7 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)/* Process request */ if (req_obj->req) { -if (trace_event_get_state (TRACE_MONITOR_QMP_CMD_IN_BAND )) { +if (trace_event_get_state_backends (TRACE_MONITOR_QMP_CMD_IN_BAND )) {QDict *qdict =qobject_to (QDict, req_obj->req);QObject *id = qdict ?qdict_get (qdict,"id" ) :NULL ;GString *id_json;
@@ -495,7 +495,7 @@ static void handle_qmp_command(void *opaque, QObject *req, Error *err)if (qdict &&qmp_is_oob (qdict)) {/* OOB commands are executed immediately */ -if (trace_event_get_state (TRACE_MONITOR_QMP_CMD_OUT_OF_BAND )) { +if (trace_event_get_state_backends (TRACE_MONITOR_QMP_CMD_OUT_OF_BAND )) {QObject *id =qdict_get (qdict,"id" );GString *id_json;
scripts/tracetool/backend/__init__.py +2 -1
@@ -26,7 +26,8 @@ considered "public". CHECK_TRACE_EVENT_GET_STATE If exists and is set to 'True', the backend-specific code inside the tracepoint is emitted within an - ``if trace_event_get_state()`` conditional. + ``if trace_event_get_state_dynamic_by_id()`` + conditional. =========================== ====================================================
scripts/tracetool/format/h.py +1 -1
@@ -60,7 +60,7 @@ def generate(events, backend, group): if backend.check_trace_event_get_state: event_id = 'TRACE_' + e.name.upper() - cond = "trace_event_get_state(%s)" % event_id + cond = "trace_event_get_state_dynamic_by_id(%s)" % event_id out(' if (%(cond)s) {', cond=cond) backend.generate(e, group, check_trace_event_get_state=True)
tests/tracetool/all.h +2 -2
@@ -54,7 +54,7 @@ static inline void trace_test_blah(void *context, const char *filename) {QEMU_TEST_BLAH (context, filename);tracepoint (qemu, test_blah, context, filename); -if (trace_event_get_state (TRACE_TEST_BLAH )) { +if (trace_event_get_state_dynamic_by_id (TRACE_TEST_BLAH )) {#line 4 "trace-events"ftrace_write ("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);#line 60 "all.h"
@@ -84,7 +84,7 @@ static inline void trace_test_wibble(void *context, int value) {QEMU_TEST_WIBBLE (context, value);tracepoint (qemu, test_wibble, context, value); -if (trace_event_get_state (TRACE_TEST_WIBBLE )) { +if (trace_event_get_state_dynamic_by_id (TRACE_TEST_WIBBLE )) {#line 5 "trace-events"ftrace_write ("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);#line 89 "all.h"
tests/tracetool/ftrace.h +2 -2
@@ -19,7 +19,7 @@ extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;static inline void trace_test_blah (void *context,const char *filename) { -if (trace_event_get_state (TRACE_TEST_BLAH )) { +if (trace_event_get_state_dynamic_by_id (TRACE_TEST_BLAH )) {#line 4 "trace-events"ftrace_write ("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);#line 26 "ftrace.h"
@@ -32,7 +32,7 @@ static inline void trace_test_blah(void *context, const char *filename)static inline void trace_test_wibble (void *context,int value) { -if (trace_event_get_state (TRACE_TEST_WIBBLE )) { +if (trace_event_get_state_dynamic_by_id (TRACE_TEST_WIBBLE )) {#line 5 "trace-events"ftrace_write ("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);#line 39 "ftrace.h"
tests/tracetool/log.h +2 -2
@@ -20,7 +20,7 @@ extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;static inline void trace_test_blah (void *context,const char *filename) { -if (trace_event_get_state (TRACE_TEST_BLAH )) { +if (trace_event_get_state_dynamic_by_id (TRACE_TEST_BLAH )) {if (qemu_loglevel_mask (LOG_TRACE )) {#line 4 "trace-events"qemu_log ("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);
@@ -36,7 +36,7 @@ static inline void trace_test_blah(void *context, const char *filename)static inline void trace_test_wibble (void *context,int value) { -if (trace_event_get_state (TRACE_TEST_WIBBLE )) { +if (trace_event_get_state_dynamic_by_id (TRACE_TEST_WIBBLE )) {if (qemu_loglevel_mask (LOG_TRACE )) {#line 5 "trace-events"qemu_log ("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);
tests/tracetool/simple.h +2 -2
@@ -20,7 +20,7 @@ void _simple_trace_test_wibble(void *context, int value);static inline void trace_test_blah (void *context,const char *filename) { -if (trace_event_get_state (TRACE_TEST_BLAH )) { +if (trace_event_get_state_dynamic_by_id (TRACE_TEST_BLAH )) {_simple_trace_test_blah (context, filename); } }
@@ -31,7 +31,7 @@ static inline void trace_test_blah(void *context, const char *filename)static inline void trace_test_wibble (void *context,int value) { -if (trace_event_get_state (TRACE_TEST_WIBBLE )) { +if (trace_event_get_state_dynamic_by_id (TRACE_TEST_WIBBLE )) {_simple_trace_test_wibble (context, value); } }
tests/tracetool/syslog.h +2 -2
@@ -19,7 +19,7 @@ extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;static inline void trace_test_blah (void *context,const char *filename) { -if (trace_event_get_state (TRACE_TEST_BLAH )) { +if (trace_event_get_state_dynamic_by_id (TRACE_TEST_BLAH )) {#line 4 "trace-events"syslog (LOG_INFO ,"test_blah " "Blah context=%p filename=%s" , context, filename);#line 26 "syslog.h"
@@ -32,7 +32,7 @@ static inline void trace_test_blah(void *context, const char *filename)static inline void trace_test_wibble (void *context,int value) { -if (trace_event_get_state (TRACE_TEST_WIBBLE )) { +if (trace_event_get_state_dynamic_by_id (TRACE_TEST_WIBBLE )) {#line 5 "trace-events"syslog (LOG_INFO ,"test_wibble " "Wibble context=%p value=%d" , context, value);#line 39 "syslog.h"
trace/control.h +0 -12
@@ -97,18 +97,6 @@ static uint32_t trace_event_get_id(TraceEvent *ev);*/ static const char *trace_event_get_name (TraceEvent *ev); -/** -* trace_event_get_state: -* @id: Event identifier name. -* -* Get the tracing state of an event, both static and the QEMU dynamic state. -* -* If the event has the disabled property, the check will have no performance -* impact. -*/ -#define trace_event_get_state (id) \ - (trace_event_get_state_dynamic_by_id(id)) -/** * trace_event_get_state_backends: * @id: Event identifier name.
Signature · 1 line
2.55.0
Hi,
Quoted 47 lines
This series started off with fixing some compile failures seen with dtrace and ust backends, and got somewhat out of hand as I looked more deeply at the trace code. So it ended up doing various bits of code cleanup and memory usage optimizations.
The optimizations aren't huge against each individual binaries. There are too many scenarios to show the full set, but here are some binary size examples
The current git master baseline for different enabled backends on the
x86_64emulator:nop 88546360
dtrace 90604496
ftrace 93265944
log 93799528
syslog 93962704
simple 97064528
ust 162999944
dtrace,ftrace,log,syslog,simple,ust 174438088'ust' has insanely high overhead in terms of binary sizes, inexplicably insane.
'ftrace/log/syslog' are all similar because their overhead is dominated by the
printf()format strings which are identical in all.'simple' is a bit worse because of the helper functions we must generated for each probe
After this series is applied the results for
x86_64arenop 88510248
dtrace 90576160
ftrace 93156320
log 93735064
syslog 93853480
simple 97050856
ust 162957256
dtrace,ftrace,log,syslog,simple,ust 174431128IOW, for 'dtrace', we save 28k, for 'log' we save 62k
For the aarch64 binary, we see bigger saving in some cases:
Quoted 8 lines
baseline dtrace 127610144
baseline log 131050320trace dtrace 127459264 trace log 130998872IOW, for 'dtrace' we save 150k, for 'log' we only save 50k. No clue why the saving is not so significant for the 'log' backend but not a big deal.
Need tracing.rst update, and maybe better commit message, but lgtm otherwise, series:
Signature · 1 line
Marc-André Lureau <[email protected]>