aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-13 07:35:00 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-13 07:40:03 -0400
commit44175b6f397a6724121eeaf0f072e2c912a46614 (patch)
tree3a4f703fd90c9c10fa0fd1c88c51abfbb1f40003 /tools/perf
parentf4db43a38f7387c3b19c9565124c06ab0c5d6e9a (diff)
perf stat: Reorganize output
- use IPC for the instruction normalization output - CPUs for the CPU utilization factor value. - print out time elapsed like the other rows - tidy up the task-clocks/cpu-clocks printout Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-stat.c67
-rw-r--r--tools/perf/util/parse-events.c4
2 files changed, 42 insertions, 29 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index c43e4a97dc42..c12804853eab 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -184,6 +184,40 @@ static void read_counter(int counter)
184 runtime_cycles = count[0]; 184 runtime_cycles = count[0];
185} 185}
186 186
187static void nsec_printout(int counter, __u64 *count)
188{
189 double msecs = (double)count[0] / 1000000;
190
191 fprintf(stderr, " %14.6f %-20s", msecs, event_name(counter));
192
193 if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
194 attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) {
195
196 if (walltime_nsecs)
197 fprintf(stderr, " # %10.3f CPUs",
198 (double)count[0] / (double)walltime_nsecs);
199 }
200}
201
202static void abs_printout(int counter, __u64 *count)
203{
204 fprintf(stderr, " %14Ld %-20s", count[0], event_name(counter));
205
206 if (runtime_cycles &&
207 attrs[counter].type == PERF_TYPE_HARDWARE &&
208 attrs[counter].config == PERF_COUNT_HW_INSTRUCTIONS) {
209
210 fprintf(stderr, " # %10.3f IPC",
211 (double)count[0] / (double)runtime_cycles);
212
213 return;
214 }
215
216 if (runtime_nsecs)
217 fprintf(stderr, " # %10.3f M/sec",
218 (double)count[0]/runtime_nsecs*1000.0);
219}
220
187/* 221/*
188 * Print out the results of a single counter: 222 * Print out the results of a single counter:
189 */ 223 */
@@ -201,35 +235,15 @@ static void print_counter(int counter)
201 return; 235 return;
202 } 236 }
203 237
204 if (nsec_counter(counter)) { 238 if (nsec_counter(counter))
205 double msecs = (double)count[0] / 1000000; 239 nsec_printout(counter, count);
206 240 else
207 fprintf(stderr, " %14.6f %-20s", 241 abs_printout(counter, count);
208 msecs, event_name(counter));
209 if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
210 attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) {
211 242
212 if (walltime_nsecs)
213 fprintf(stderr, " # %11.3f CPU utilization factor",
214 (double)count[0] / (double)walltime_nsecs);
215 }
216 } else {
217 fprintf(stderr, " %14Ld %-20s",
218 count[0], event_name(counter));
219 if (runtime_nsecs)
220 fprintf(stderr, " # %11.3f M/sec",
221 (double)count[0]/runtime_nsecs*1000.0);
222 if (runtime_cycles &&
223 attrs[counter].type == PERF_TYPE_HARDWARE &&
224 attrs[counter].config == PERF_COUNT_HW_INSTRUCTIONS) {
225
226 fprintf(stderr, " # %1.3f per cycle",
227 (double)count[0] / (double)runtime_cycles);
228 }
229 }
230 if (scaled) 243 if (scaled)
231 fprintf(stderr, " (scaled from %.2f%%)", 244 fprintf(stderr, " (scaled from %.2f%%)",
232 (double) count[2] / count[1] * 100); 245 (double) count[2] / count[1] * 100);
246
233 fprintf(stderr, "\n"); 247 fprintf(stderr, "\n");
234} 248}
235 249
@@ -290,8 +304,7 @@ static int do_perf_stat(int argc, const char **argv)
290 304
291 305
292 fprintf(stderr, "\n"); 306 fprintf(stderr, "\n");
293 fprintf(stderr, " Wall-clock time elapsed: %12.6f msecs\n", 307 fprintf(stderr, " %14.9f seconds time elapsed.\n", (double)(t1-t0)/1e9);
294 (double)(t1-t0)/1e6);
295 fprintf(stderr, "\n"); 308 fprintf(stderr, "\n");
296 309
297 return 0; 310 return 0;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 5a72586e1df0..f0c9f2627fe1 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -63,8 +63,8 @@ static char *hw_event_names[] = {
63}; 63};
64 64
65static char *sw_event_names[] = { 65static char *sw_event_names[] = {
66 "cpu-clock-ticks", 66 "cpu-clock-msecs",
67 "task-clock-ticks", 67 "task-clock-msecs",
68 "page-faults", 68 "page-faults",
69 "context-switches", 69 "context-switches",
70 "CPU-migrations", 70 "CPU-migrations",