diff options
author | Steven Rostedt <srostedt@redhat.com> | 2012-04-06 00:47:57 +0200 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2012-04-25 13:35:18 +0200 |
commit | 4dc1024a7a529626de5a800b10088bcbbc1ae941 (patch) | |
tree | 53100c8ed8b599568cc6f1f023e1a709d3eeda1f /tools/lib/traceevent/event-parse.c | |
parent | perf: Have perf use the new libtraceevent.a library (diff) | |
download | linux-4dc1024a7a529626de5a800b10088bcbbc1ae941.tar.xz linux-4dc1024a7a529626de5a800b10088bcbbc1ae941.zip |
perf/events: Add flag to produce nsec output
libtraceevent library prints out in usecs but perf wants to print out
in nsecs. Add a flag that lets the user decide to print out in usec
or nsec times.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Arun Sharma <asharma@fb.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'tools/lib/traceevent/event-parse.c')
-rw-r--r-- | tools/lib/traceevent/event-parse.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index 3ce75b5d7612..c799c19f9340 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -3940,15 +3940,16 @@ void pevent_print_event(struct pevent *pevent, struct trace_seq *s, struct event_format *event; unsigned long secs; unsigned long usecs; + unsigned long nsecs; const char *comm; void *data = record->data; int type; int pid; int len; + int p; secs = record->ts / NSECS_PER_SEC; - usecs = record->ts - secs * NSECS_PER_SEC; - usecs = (usecs + 500) / NSECS_PER_USEC; + nsecs = record->ts - secs * NSECS_PER_SEC; if (record->size < 0) { do_warning("ug! negative record size %d", record->size); @@ -3973,7 +3974,15 @@ void pevent_print_event(struct pevent *pevent, struct trace_seq *s, } else trace_seq_printf(s, "%16s-%-5d [%03d]", comm, pid, record->cpu); - trace_seq_printf(s, " %5lu.%06lu: %s: ", secs, usecs, event->name); + if (pevent->flags & PEVENT_NSEC_OUTPUT) { + usecs = nsecs; + p = 9; + } else { + usecs = (nsecs + 500) / NSECS_PER_USEC; + p = 6; + } + + trace_seq_printf(s, " %5lu.%0*lu: %s: ", secs, p, usecs, event->name); /* Space out the event names evenly. */ len = strlen(event->name); |