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 ', + '#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,