perf record, top: Implement --freq
Support frequency-based profiling and make it the default.
(Also add a Hz printout in perf top.)
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>
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 28cbde4..2fee595 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -74,8 +74,8 @@
static unsigned int realtime_prio = 0;
static int group = 0;
static unsigned int page_size;
-static unsigned int mmap_pages = 16;
-static int freq = 0;
+static unsigned int mmap_pages = 16;
+static int freq = 0;
static char *sym_filter;
static unsigned long filter_start;
@@ -212,8 +212,13 @@
events_per_sec,
100.0 - (100.0*((events_per_sec-kevents_per_sec)/events_per_sec)));
- if (nr_counters == 1)
- printf("%d ", event_count[0]);
+ if (nr_counters == 1) {
+ printf("%d", event_count[0]);
+ if (freq)
+ printf("Hz ");
+ else
+ printf(" ");
+ }
for (counter = 0; counter < nr_counters; counter++) {
if (counter)