qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/1] Print PID and time in stderr traces


From: Dr. David Alan Gilbert
Subject: Re: [Qemu-devel] [PATCH v2 1/1] Print PID and time in stderr traces
Date: Thu, 5 Feb 2015 19:39:31 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

* Dr. David Alan Gilbert (git) (address@hidden) wrote:
> From: "Dr. David Alan Gilbert" <address@hidden>
> 
> When debugging migration it's useful to know the PID of
> each trace message so you can figure out if it came from the source
> or the destination.
> 
> Printing the time makes it easy to do latency measurements or timings
> between trace points.
> 
> Signed-off-by: Dr. David Alan Gilbert <address@hidden>

Ping.

Dave

> ---
> 
> v2
>   0 pad usec part
> 
>  scripts/tracetool/backend/stderr.py | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/tracetool/backend/stderr.py 
> b/scripts/tracetool/backend/stderr.py
> index 2a1e906..ca58054 100644
> --- a/scripts/tracetool/backend/stderr.py
> +++ b/scripts/tracetool/backend/stderr.py
> @@ -21,6 +21,9 @@ PUBLIC = True
>  
>  def generate_h_begin(events):
>      out('#include <stdio.h>',
> +        '#include <sys/time.h>',
> +        '#include <sys/types.h>',
> +        '#include <unistd.h>',
>          '#include "trace/control.h"',
>          '')
>  
> @@ -31,7 +34,12 @@ def generate_h(event):
>          argnames = ", " + argnames
>  
>      out('    if (trace_event_get_state(%(event_id)s)) {',
> -        '        fprintf(stderr, "%(name)s " %(fmt)s "\\n" %(argnames)s);',
> +        '        struct timeval _now;',
> +        '        gettimeofday(&_now, NULL);',
> +        '        fprintf(stderr, "address@hidden:%(name)s " %(fmt)s "\\n",',
> +        '                        getpid(),',
> +        '                        (size_t)_now.tv_sec, (size_t)_now.tv_usec',
> +        '                        %(argnames)s);',
>          '    }',
>          event_id="TRACE_" + event.name.upper(),
>          name=event.name,
> -- 
> 2.1.0
> 
> 
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK



reply via email to

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