aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
authorDavid Ahern <daahern@cisco.com>2011-03-10 00:23:25 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-03-14 16:05:55 -0400
commitc70c94b47405d2c94df19c16273daf1f5fb9193d (patch)
tree44e1f7bb1752bfde03e65b1435a4172a6d67a0d2 /tools/perf/builtin-script.c
parent2ee7a49f935b19f7daf0a110800488acd2479cba (diff)
perf script: Move printing of 'common' data from print_event and rename
This change does impact output: latency data is trace specific and is now printed after the common data - comm, tid, cpu, time and event name. Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> LKML-Reference: <1299734608-5223-4-git-send-email-daahern@cisco.com> Signed-off-by: David Ahern <daahern@cisco.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r--tools/perf/builtin-script.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index b2bdd5534026..0a79da21df23 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -20,18 +20,42 @@ static u64 last_timestamp;
20static u64 nr_unordered; 20static u64 nr_unordered;
21extern const struct option record_options[]; 21extern const struct option record_options[];
22 22
23static void print_sample_start(struct perf_sample *sample,
24 struct thread *thread)
25{
26 int type;
27 struct event *event;
28 const char *evname = NULL;
29 unsigned long secs;
30 unsigned long usecs;
31 unsigned long long nsecs = sample->time;
32
33 if (latency_format)
34 printf("%8.8s-%-5d %3d", thread->comm, sample->tid, sample->cpu);
35 else
36 printf("%16s-%-5d [%03d]", thread->comm, sample->tid, sample->cpu);
37
38 secs = nsecs / NSECS_PER_SEC;
39 nsecs -= secs * NSECS_PER_SEC;
40 usecs = nsecs / NSECS_PER_USEC;
41 printf(" %5lu.%06lu: ", secs, usecs);
42
43 type = trace_parse_common_type(sample->raw_data);
44 event = trace_find_event(type);
45 if (event)
46 evname = event->name;
47
48 printf("%s: ", evname ? evname : "(unknown)");
49}
50
23static void process_event(union perf_event *event __unused, 51static void process_event(union perf_event *event __unused,
24 struct perf_sample *sample, 52 struct perf_sample *sample,
25 struct perf_session *session __unused, 53 struct perf_session *session __unused,
26 struct thread *thread) 54 struct thread *thread)
27{ 55{
28 /* 56 print_sample_start(sample, thread);
29 * FIXME: better resolve from pid from the struct trace_entry 57 print_trace_event(sample->cpu, sample->raw_data, sample->raw_size);
30 * field, although it should be the same than this perf 58 printf("\n");
31 * event pid
32 */
33 print_event(sample->cpu, sample->raw_data, sample->raw_size,
34 sample->time, thread->comm);
35} 59}
36 60
37static int default_start_script(const char *script __unused, 61static int default_start_script(const char *script __unused,