aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/traceevent/event-parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/traceevent/event-parse.c')
-rw-r--r--tools/lib/traceevent/event-parse.c15
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,
3940 struct event_format *event; 3940 struct event_format *event;
3941 unsigned long secs; 3941 unsigned long secs;
3942 unsigned long usecs; 3942 unsigned long usecs;
3943 unsigned long nsecs;
3943 const char *comm; 3944 const char *comm;
3944 void *data = record->data; 3945 void *data = record->data;
3945 int type; 3946 int type;
3946 int pid; 3947 int pid;
3947 int len; 3948 int len;
3949 int p;
3948 3950
3949 secs = record->ts / NSECS_PER_SEC; 3951 secs = record->ts / NSECS_PER_SEC;
3950 usecs = record->ts - secs * NSECS_PER_SEC; 3952 nsecs = record->ts - secs * NSECS_PER_SEC;
3951 usecs = (usecs + 500) / NSECS_PER_USEC;
3952 3953
3953 if (record->size < 0) { 3954 if (record->size < 0) {
3954 do_warning("ug! negative record size %d", record->size); 3955 do_warning("ug! negative record size %d", record->size);
@@ -3973,7 +3974,15 @@ void pevent_print_event(struct pevent *pevent, struct trace_seq *s,
3973 } else 3974 } else
3974 trace_seq_printf(s, "%16s-%-5d [%03d]", comm, pid, record->cpu); 3975 trace_seq_printf(s, "%16s-%-5d [%03d]", comm, pid, record->cpu);
3975 3976
3976 trace_seq_printf(s, " %5lu.%06lu: %s: ", secs, usecs, event->name); 3977 if (pevent->flags & PEVENT_NSEC_OUTPUT) {
3978 usecs = nsecs;
3979 p = 9;
3980 } else {
3981 usecs = (nsecs + 500) / NSECS_PER_USEC;
3982 p = 6;
3983 }
3984
3985 trace_seq_printf(s, " %5lu.%0*lu: %s: ", secs, p, usecs, event->name);
3977 3986
3978 /* Space out the event names evenly. */ 3987 /* Space out the event names evenly. */
3979 len = strlen(event->name); 3988 len = strlen(event->name);