qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH-for-4.2] tracing: Allow to tune tracing opti


From: Daniel P . Berrangé
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
User-agent: Mutt/1.12.0 (2019-05-25)

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é <address@hidden>
> ---
> 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 :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]