path: root/tools/perf/perf.c
diff options
authorNamhyung Kim <>2016-01-07 20:41:53 +0900
committerArnaldo Carvalho de Melo <>2016-01-08 13:15:46 -0300
commit14cbfbeb76540cc0c53fbb0ba34b3a4900ebe40f (patch)
tree51bc19a46a576c64d784b6c0713eee59c8f73de3 /tools/perf/perf.c
parentfc284be9d88528dd2a28d5471e40a6acde6c3036 (diff)
perf report: Show random usage tip on the help line
Currently perf report only shows a help message "For a higher level overview, try: perf report --sort comm,dso" unconditionally (even if the sort keys were used). Add more help tips and show randomly. Load tips from ${prefix}/share/doc/perf-tip/tips.txt file. $ perf report | tail 0.10% swapper [kernel.vmlinux] [k] irq_exit 0.09% swapper [kernel.vmlinux] [k] flush_smp_call_function_queue 0.08% swapper [kernel.vmlinux] [k] native_write_msr_safe 0.03% swapper [kernel.vmlinux] [k] group_sched_in 0.01% perf [kernel.vmlinux] [k] native_write_msr_safe # # (Tip: Search options using a keyword: perf report -h <keyword>) # Signed-off-by: Namhyung Kim <> Acked-by: Ingo Molnar <> Cc: Andi Kleen <> Cc: David Ahern <> Cc: Jiri Olsa <> Cc: Masami Hiramatsu <> Cc: Peter Zijlstra <> Cc: Stephane Eranian <> Cc: Wang Nan <> Link: [ Renamed it to perf_tip() and the parameter dirname to dirpath to fix the build on older distros ] Signed-off-by: Arnaldo Carvalho de Melo <>
Diffstat (limited to 'tools/perf/perf.c')
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index cb1d2499c45c..a929618b8eb6 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -19,6 +19,8 @@
#include "util/debug.h"
#include <api/fs/tracing_path.h>
#include <pthread.h>
+#include <stdlib.h>
+#include <time.h>
const char perf_usage_string[] =
"perf [--version] [--help] [OPTIONS] COMMAND [ARGS]";
@@ -542,6 +544,8 @@ int main(int argc, const char **argv)
if (!cmd)
cmd = "perf-help";
+ srandom(time(NULL));
/* get debugfs/tracefs mount point from /proc/mounts */