v2:
 * Don't special-case QEMU dstate [Daniel Berrange]
 * Use _backends() postfix to clarify function purpose [Lluís]

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: add trace_event_get_state_backends()

 docs/devel/tracing.txt                |  2 +-
 trace/control.h                       | 18 +++++++++++++++++-
 hw/usb/hcd-ohci.c                     | 13 +++++--------
 net/colo-compare.c                    | 11 ++++++-----
 net/filter-rewriter.c                 |  4 ++--
 scripts/tracetool/__init__.py         |  1 +
 scripts/tracetool/backend/__init__.py |  3 +++
 scripts/tracetool/backend/dtrace.py   | 12 ++++++++++++
 scripts/tracetool/backend/ftrace.py   |  5 +++++
 scripts/tracetool/backend/log.py      |  5 +++++
 scripts/tracetool/backend/simple.py   |  5 +++++
 scripts/tracetool/backend/syslog.py   |  5 +++++
 scripts/tracetool/backend/ust.py      |  5 +++++
 scripts/tracetool/format/h.py         | 10 ++++++++++
 14 files changed, 82 insertions(+), 17 deletions(-)

-- 
2.13.3


Reply via email to