From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: [Qemu-devel] [RFC PATCH-for-4.2] tracing: Allow to tune tracing options via the environment
Date: Wed, 3 Jul 2019 19:10:05 +0200 [thread overview]
Message-ID: <20190703171005.26231-1-philmd@redhat.com> (raw)
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);
+ }
+
return true;
}
--
2.20.1
next reply other threads:[~2019-07-03 17:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-03 17:10 Philippe Mathieu-Daudé [this message]
2019-07-03 17:25 ` [Qemu-devel] [RFC PATCH-for-4.2] tracing: Allow to tune tracing options via the environment Daniel P. Berrangé
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=20190703171005.26231-1-philmd@redhat.com \
--to=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 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).