Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304974
b: refs/heads/master
c: 4dc1024
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Frederic Weisbecker committed Apr 25, 2012
1 parent dff927f commit d67025d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aaf045f72335653b24784d6042be8e4aee114403
refs/heads/master: 4dc1024a7a529626de5a800b10088bcbbc1ae941
15 changes: 12 additions & 3 deletions trunk/tools/lib/traceevent/event-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
12 changes: 12 additions & 0 deletions trunk/tools/lib/traceevent/event-parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ enum pevent_func_arg_type {
PEVENT_FUNC_ARG_MAX_TYPES
};

enum pevent_flag {
PEVENT_NSEC_OUTPUT = 1, /* output in NSECS */
};

struct cmdline;
struct cmdline_list;
struct func_map;
Expand Down Expand Up @@ -373,6 +377,7 @@ struct pevent {
struct printk_list *printklist;
unsigned int printk_count;


struct event_format **events;
int nr_events;
struct event_format **sort_events;
Expand All @@ -397,6 +402,8 @@ struct pevent {

int test_filters;

int flags;

struct format_field *bprint_ip_field;
struct format_field *bprint_fmt_field;
struct format_field *bprint_buf_field;
Expand All @@ -408,6 +415,11 @@ struct pevent {
struct event_format *last_event;
};

static inline void pevent_set_flag(struct pevent *pevent, int flag)
{
pevent->flags |= flag;
}

static inline unsigned short
__data2host2(struct pevent *pevent, unsigned short data)
{
Expand Down
1 change: 1 addition & 0 deletions trunk/tools/perf/util/trace-event-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ int read_trace_init(int file_bigendian, int host_bigendian)
perf_pevent = pevent_alloc();
pevent = perf_pevent;

pevent_set_flag(pevent, PEVENT_NSEC_OUTPUT);
pevent_set_file_bigendian(pevent, file_bigendian);
pevent_set_host_bigendian(pevent, host_bigendian);

Expand Down

0 comments on commit d67025d

Please sign in to comment.