[Qemu-devel] [PATCH v2 0/2] trace: fix trace_event_get_state() for SystemTap and LTTng UST

Stefan Hajnoczi posted 2 patches 6 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170731140718.22010-1-stefanha@redhat.com
Test FreeBSD passed
Test checkpatch passed
Test docker passed
Test s390x passed
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(-)
[Qemu-devel] [PATCH v2 0/2] trace: fix trace_event_get_state() for SystemTap and LTTng UST
Posted by Stefan Hajnoczi 6 years, 8 months ago
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


Re: [Qemu-devel] [PATCH v2 0/2] trace: fix trace_event_get_state() for SystemTap and LTTng UST
Posted by Stefan Hajnoczi 6 years, 8 months ago
On Mon, Jul 31, 2017 at 03:07:16PM +0100, Stefan Hajnoczi wrote:
> 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
> 
> 

Thanks, applied to my tracing tree:
https://github.com/stefanha/qemu/commits/tracing

Stefan