Skip to contentSkip to conversation

Tracing patches

GIT PULL Applied Stefan Hajnoczi 2 participants 3 messages Feb 6, 2015

lore
Share & tools
lore
#0 lore raw

The following changes since commit 16017c48547960539fcadb1f91d252124f442482:

softfloat: Clarify license status (2015-01-29 16:45:45 +0000)

are available in the git repository at:

git://github.com/stefanha/qemu.git tags/tracing-pull-request

for you to fetch changes up to dd9fe29c80b8a35f12d98928a97be3aded80cf69:

trace: Print PID and time in stderr traces (2015-02-06 10:27:22 +0000)

----------------------------------------------------------------

----------------------------------------------------------------

Dr. David Alan Gilbert (1):
trace: Print PID and time in stderr traces

 scripts/tracetool/backend/stderr.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
2.1.0
#1 lore raw

[Qemu-devel] [PULL 1/1] trace: Print PID and time in stderr traces

From: "Dr. David Alan Gilbert" <[email protected]>

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.

Message-id: [email protected]

---
 scripts/tracetool/backend/stderr.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
scripts/tracetool/backend/stderr.py +9 -1
index 2a1e906..ca58054 100644
@@ -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,
Signature · 1 line
2.1.0
#2 lore raw
In reply to Stefan Hajnoczi
Quoted 8 lines · Stefan Hajnoczi

The following changes since commit 16017c48547960539fcadb1f91d252124f442482:

softfloat: Clarify license status (2015-01-29 16:45:45 +0000)

are available in the git repository at:

git://github.com/stefanha/qemu.git tags/tracing-pull-request

Quoted 7 lines

for you to fetch changes up to dd9fe29c80b8a35f12d98928a97be3aded80cf69:

trace: Print PID and time in stderr traces (2015-02-06 10:27:22 +0000)

----------------------------------------------------------------

----------------------------------------------------------------

Applied, thanks.

-- PMM