From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH-for-4.2] tracing: Allow to tune tracing options via the environment
Date: Wed, 3 Jul 2019 18:25:01 +0100 [thread overview]
Message-ID: <20190703172501.GI23082@redhat.com> (raw)
In-Reply-To: <20190703171005.26231-1-philmd@redhat.com>
On Wed, Jul 03, 2019 at 07:10:05PM +0200, Philippe Mathieu-Daudé wrote:
> We can pass trace trace options with the -trace command line
> argument.
>
> Tracing might be useful when running qtests. To avoid to have
> to modify the tests and recompile, add the possibility to pass
> trace options via the shell environment.
>
> We add:
> - QEMU_TRACE_EVENTS: List of events to enable (coma separated)
> - QEMU_TRACE_EVENTFILE: File with list of events to enable
> - QEMU_TRACE_LOGFILE: File to log the trace events.
>
> Example of use:
>
> $ QEMU_TRACE_EVENTS=pl011\* make check-qtest-arm
> TEST check-qtest-arm: tests/boot-serial-test
> 18650@1562168430.027490:pl011_can_receive LCR 0x00000000 read_count 0 returning 1
> 18650@1562168430.027535:pl011_can_receive LCR 0x00000000 read_count 0 returning 1
> 18650@1562168430.027544:pl011_can_receive LCR 0x00000000 read_count 0 returning 1
> 18650@1562168430.028037:pl011_can_receive LCR 0x00000000 read_count 0 returning 1
> 18650@1562168430.028049:pl011_can_receive LCR 0x00000000 read_count 0 returning 1
> 18650@1562168430.028057:pl011_can_receive LCR 0x00000000 read_count 0 returning 1
> 18653@1562168430.053250:pl011_write addr 0x00000000 value 0x00000054
> 18653@1562168430.053276:pl011_irq_state irq state 0
> [...]
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> I'm not sure where to document that...
> ---
> trace/control.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/trace/control.c b/trace/control.c
> index 43fb7868db..aea802623c 100644
> --- a/trace/control.c
> +++ b/trace/control.c
> @@ -288,6 +288,8 @@ void trace_fini_vcpu(CPUState *vcpu)
>
> bool trace_init_backends(void)
> {
> + char *trace_env;
> +
> #ifdef CONFIG_TRACE_SIMPLE
> if (!st_init()) {
> fprintf(stderr, "failed to initialize simple tracing backend.\n");
> @@ -306,6 +308,13 @@ bool trace_init_backends(void)
> openlog(NULL, LOG_PID, LOG_DAEMON);
> #endif
>
> + trace_init_file(getenv("QEMU_TRACE_LOGFILE"));
> + trace_init_events(getenv("QEMU_TRACE_EVENTFILE"));
> + trace_env = getenv("QEMU_TRACE_EVENTS");
> + if (trace_env) {
> + trace_enable_events(trace_env);
> + }
> +
I don't think it is a nice idea to add this via environment variables
to QEMU itself. Why not modify libqtest qtest_init_without_qmp_handshake
to read the env vars and then pass a suitable -trace arg when spawning
QEMU ?
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:[~2019-07-03 17:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-03 17:10 [Qemu-devel] [RFC PATCH-for-4.2] tracing: Allow to tune tracing options via the environment Philippe Mathieu-Daudé
2019-07-03 17:25 ` Daniel P. Berrangé [this message]
2019-07-03 17:29 ` Philippe Mathieu-Daudé
2019-07-04 10:24 ` Stefan Hajnoczi
2019-07-04 10:28 ` Daniel P. Berrangé
2019-07-05 8:07 ` Stefan Hajnoczi
2019-07-05 9:48 ` Philippe Mathieu-Daudé
2019-07-05 13:19 ` Markus Armbruster
2019-07-05 17:53 ` Philippe Mathieu-Daudé
2019-07-06 4:02 ` Markus Armbruster
2019-07-08 9:34 ` Daniel P. Berrangé
2019-07-08 10:27 ` Philippe Mathieu-Daudé
2019-07-08 10:38 ` Daniel P. Berrangé
2019-07-09 5:53 ` Markus Armbruster
2019-07-09 7:58 ` Stefan Hajnoczi
2019-07-03 21:58 ` no-reply
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=20190703172501.GI23082@redhat.com \
--to=berrange@redhat.com \
--cc=philmd@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.