From 14cbfbeb76540cc0c53fbb0ba34b3a4900ebe40f Mon Sep 17 00:00:00 2001 From: Namhyung Kim Date: Thu, 7 Jan 2016 20:41:53 +0900 Subject: 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 ) # 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: http://lkml.kernel.org/r/1452166913-27046-1-git-send-email-namhyung@kernel.org [ 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 --- tools/perf/perf.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/perf/perf.c') 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 #include +#include +#include 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 */ tracing_path_mount(); -- cgit v1.2.3