From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJSH7-0004hj-Oy for qemu-devel@nongnu.org; Thu, 05 Feb 2015 14:39:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJSH3-0006zS-PZ for qemu-devel@nongnu.org; Thu, 05 Feb 2015 14:39:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45028) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJSH3-0006zC-J2 for qemu-devel@nongnu.org; Thu, 05 Feb 2015 14:39:37 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t15Jdarw030549 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 5 Feb 2015 14:39:36 -0500 Date: Thu, 5 Feb 2015 19:39:31 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20150205193930.GI2589@work-vm> References: <1421746875-9962-1-git-send-email-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1421746875-9962-1-git-send-email-dgilbert@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 1/1] Print PID and time in stderr traces List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, stefanha@redhat.com * Dr. David Alan Gilbert (git) (dgilbert@redhat.com) wrote: > From: "Dr. David Alan Gilbert" > > 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 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 ', > + '#include ', > + '#include ', > + '#include ', > '#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