[PATCH 0/3] Use only trace_event_get_state_backends() to check trace enablement

Peter Maydell posted 3 patches 4 years, 3 months ago
Test FreeBSD passed
Test docker-mingw@fedora passed
Test checkpatch passed
Test docker-quick@centos7 passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200120151142.18954-1-peter.maydell@linaro.org
Maintainers: Stefan Hajnoczi <stefanha@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
docs/devel/tracing.txt | 12 +++++-------
hw/display/qxl.c       |  2 +-
memory.c               |  8 ++++----
3 files changed, 10 insertions(+), 12 deletions(-)
[PATCH 0/3] Use only trace_event_get_state_backends() to check trace enablement
Posted by Peter Maydell 4 years, 3 months ago
Currently docs/devel/tracing.txt recommends checking the
TRACE_FOO_ENABLED macro to see if the FOO event is enabled,
for the purpose of skipping expensive computations that
are only used in trace output.

This is no longer the best way to do this; instead we
should prefer trace_event_get_state_backends(), which
checks both whether the event is compile-time disabled
and also whether it is run-time disabled.

Update the documentation, and also the 5 uses of the
old style in the tree.

thanks
-- PMM

Peter Maydell (3):
  docs/devel/tracing.txt: Recommend only
    trace_event_get_state_backends()
  memory.c: Use trace_event_get_state_backends()
  hw/display/qxl.c: Use trace_event_get_state_backends()

 docs/devel/tracing.txt | 12 +++++-------
 hw/display/qxl.c       |  2 +-
 memory.c               |  8 ++++----
 3 files changed, 10 insertions(+), 12 deletions(-)

-- 
2.20.1


Re: [PATCH 0/3] Use only trace_event_get_state_backends() to check trace enablement
Posted by Stefan Hajnoczi 4 years, 3 months ago
On Mon, Jan 20, 2020 at 03:11:39PM +0000, Peter Maydell wrote:
> Currently docs/devel/tracing.txt recommends checking the
> TRACE_FOO_ENABLED macro to see if the FOO event is enabled,
> for the purpose of skipping expensive computations that
> are only used in trace output.
> 
> This is no longer the best way to do this; instead we
> should prefer trace_event_get_state_backends(), which
> checks both whether the event is compile-time disabled
> and also whether it is run-time disabled.
> 
> Update the documentation, and also the 5 uses of the
> old style in the tree.
> 
> thanks
> -- PMM
> 
> Peter Maydell (3):
>   docs/devel/tracing.txt: Recommend only
>     trace_event_get_state_backends()
>   memory.c: Use trace_event_get_state_backends()
>   hw/display/qxl.c: Use trace_event_get_state_backends()
> 
>  docs/devel/tracing.txt | 12 +++++-------
>  hw/display/qxl.c       |  2 +-
>  memory.c               |  8 ++++----
>  3 files changed, 10 insertions(+), 12 deletions(-)
> 
> -- 
> 2.20.1
> 
> 

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

Stefan