On 07/28/2017 12:20 PM, Stefan Hajnoczi wrote: > Trace events that compute their arguments can affect performance. The > following idom can be used to avoid computing arguments when the trace event > is > disabled: > > if (trace_event_get_state(TRACE_MY_EVENT)) { > char *str = g_strdup_printf("Expensive string ...", ...); > trace_my_event(str); > g_free(str); > } > > Unfortunately this breaks the trace event for SystemTap and LTTng UST since > those tracers manage their own enabled/disabled state. > > These patches add per-backend dstate to trace_event_get_state() so that the > trace event fires as expected when enabled via SystemTap or LTTng UST. > > Stefan Hajnoczi (2): > trace: add TRACE_<event>_BACKEND_DSTATE() > trace: check backend dstate in trace_event_get_state() > > trace/control.h | 20 ++++++++++++++++++-- > scripts/tracetool/__init__.py | 1 + > scripts/tracetool/backend/__init__.py | 3 +++ > scripts/tracetool/backend/dtrace.py | 12 ++++++++++++ > scripts/tracetool/backend/ftrace.py | 2 +- > scripts/tracetool/backend/log.py | 3 ++- > scripts/tracetool/backend/simple.py | 2 +- > scripts/tracetool/backend/syslog.py | 3 ++- > scripts/tracetool/backend/ust.py | 5 +++++ > scripts/tracetool/format/h.py | 10 ++++++++++ > 10 files changed, 55 insertions(+), 6 deletions(-) > looks good to me!
This also fixes the same issue not only in my code, but in static void ohci_td_pkt(const char *msg, const uint8_t *buf, size_t len) and in colo code. Reviewed-by: Denis V. Lunev <d...@openvz.org>