aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-02-06 13:46:12 +0000
committerPeter Maydell <peter.maydell@linaro.org>2015-02-06 13:46:12 +0000
commitb93acb92cad1f38737e481fc85cb5c41a559d855 (patch)
tree4ba6b04adb2e994d01e6119d5902cfdeb17ea64a
parentb3cd91e0eaf5c962cf139ce6ca59392c8b00f177 (diff)
parentdd9fe29c80b8a35f12d98928a97be3aded80cf69 (diff)
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
# gpg: Signature made Fri 06 Feb 2015 13:45:06 GMT using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/tracing-pull-request: trace: Print PID and time in stderr traces Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--scripts/tracetool/backend/stderr.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/tracetool/backend/stderr.py b/scripts/tracetool/backend/stderr.py
index 2a1e9064c3..ca58054621 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,