qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 1/1] Print PID and time in stderr traces
Date: Thu, 5 Feb 2015 19:39:31 +0000	[thread overview]
Message-ID: <20150205193930.GI2589@work-vm> (raw)
In-Reply-To: <1421746875-9962-1-git-send-email-dgilbert@redhat.com>

* Dr. David Alan Gilbert (git) (dgilbert@redhat.com) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> 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 <dgilbert@redhat.com>

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, "%%d@%%zd.%%06zd:%(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 / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2015-02-05 19:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20  9:41 [Qemu-devel] [PATCH v2 1/1] Print PID and time in stderr traces Dr. David Alan Gilbert (git)
2015-02-05 19:39 ` Dr. David Alan Gilbert [this message]
2015-02-06 10:29 ` Stefan Hajnoczi

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=20150205193930.GI2589@work-vm \
    --to=dgilbert@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).