From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Christophe de Dinechin <dinechin@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>,
Michael Tokarev <mjt@tls.msk.ru>,
Laurent Vivier <laurent@vivier.eu>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH v2 3/3] trace: Example of "centralized" recorder tracing
Date: Tue, 30 Jun 2020 13:41:36 +0100 [thread overview]
Message-ID: <20200630124136.GM1370404@redhat.com> (raw)
In-Reply-To: <20200626162706.3304357-4-dinechin@redhat.com>
On Fri, Jun 26, 2020 at 06:27:06PM +0200, Christophe de Dinechin wrote:
> This is an example showing how the recorder can be used to have one
> "topic" covering multiple entries. Here, the topic is "lock".
>
> Here are a few use cases:
>
> - Checking locks:
> RECORDER_TRACES=lock qemu
> - Graphic visualization of locks:
> RECORDER_TRACES="lock=state,id" qemu &
> recorder_scope state
> <Hit the 't' key to toggle timing display>
> <Hit the 'c' key to dump the screen data as CSV>
> cat recorder_scope_data-1.csv
>
> Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
> ---
> util/qemu-thread-common.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/util/qemu-thread-common.h b/util/qemu-thread-common.h
> index 2af6b12085..0de07a471f 100644
> --- a/util/qemu-thread-common.h
> +++ b/util/qemu-thread-common.h
> @@ -15,6 +15,9 @@
>
> #include "qemu/thread.h"
> #include "trace.h"
> +#include "trace/recorder.h"
> +
> +RECORDER_DEFINE(lock, 16, "Lock state");
>
> static inline void qemu_mutex_post_init(QemuMutex *mutex)
> {
> @@ -23,12 +26,14 @@ static inline void qemu_mutex_post_init(QemuMutex *mutex)
> mutex->line = 0;
> #endif
> mutex->initialized = true;
> + record(lock, "Init state %d for %p", -1, mutex);
> }
>
> static inline void qemu_mutex_pre_lock(QemuMutex *mutex,
> const char *file, int line)
> {
> trace_qemu_mutex_lock(mutex, file, line);
> + record(lock, "Locking state %d for %p", 1, mutex);
> }
>
> static inline void qemu_mutex_post_lock(QemuMutex *mutex,
> @@ -39,6 +44,7 @@ static inline void qemu_mutex_post_lock(QemuMutex *mutex,
> mutex->line = line;
> #endif
> trace_qemu_mutex_locked(mutex, file, line);
> + record(lock, "Locked state %d for %p", 2, mutex);
> }
>
> static inline void qemu_mutex_pre_unlock(QemuMutex *mutex,
> @@ -49,6 +55,7 @@ static inline void qemu_mutex_pre_unlock(QemuMutex *mutex,
> mutex->line = 0;
> #endif
> trace_qemu_mutex_unlock(mutex, file, line);
> + record(lock, "Unkocked state %d for %p", 0, mutex);
> }
IMHO the whole point of having the pluggable trace backend impls, is
precisely that we don't have to add multiple different calls in the
code. A single trace_qemu_mutex_unlock() is supposed to work with
any backend.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2020-06-30 12:42 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-26 16:27 [PATCH v2 0/3] trace: Add a trace backend for the recorder library Christophe de Dinechin
2020-06-26 16:27 ` [PATCH v2 1/3] Makefile: Compute libraries for libqemuutil.a and libvhost-user.a Christophe de Dinechin
2020-06-30 12:23 ` Stefan Hajnoczi
2020-06-26 16:27 ` [PATCH v2 2/3] trace: Add support for recorder back-end Christophe de Dinechin
2020-06-30 9:05 ` Dr. David Alan Gilbert
2020-06-30 13:28 ` Christophe de Dinechin
2020-06-30 17:46 ` Dr. David Alan Gilbert
2020-06-30 12:55 ` Stefan Hajnoczi
2020-06-30 13:02 ` Daniel P. Berrangé
2020-07-23 12:12 ` Christophe de Dinechin
2020-07-23 14:06 ` Markus Armbruster
2020-07-23 16:15 ` Christophe de Dinechin
2020-07-27 8:23 ` Markus Armbruster
2020-07-28 11:49 ` Christophe de Dinechin
2020-07-29 11:53 ` Markus Armbruster
2020-07-29 15:52 ` Christophe de Dinechin
2020-07-30 8:13 ` Markus Armbruster
2020-07-30 10:29 ` Christophe de Dinechin
2020-06-26 16:27 ` [PATCH v2 3/3] trace: Example of "centralized" recorder tracing Christophe de Dinechin
2020-06-30 12:41 ` Daniel P. Berrangé [this message]
2020-07-01 16:09 ` Stefan Hajnoczi
2020-07-01 16:15 ` Daniel P. Berrangé
2020-07-02 13:47 ` Stefan Hajnoczi
2020-07-03 10:12 ` Christophe de Dinechin
2020-07-03 13:08 ` Daniel P. Berrangé
2020-07-03 16:45 ` Christophe de Dinechin
2020-06-30 12:58 ` Stefan Hajnoczi
2020-06-26 16:34 ` [PATCH v2 0/3] trace: Add a trace backend for the recorder library no-reply
2020-06-30 12:59 ` Stefan Hajnoczi
2020-07-03 10:37 ` Christophe de Dinechin
2020-07-03 11:27 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200630124136.GM1370404@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=dinechin@redhat.com \
--cc=laurent@vivier.eu \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).