From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Jiri Olsa <jolsa@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
David Ahern <dsahern@gmail.com>,
Stephane Eranian <eranian@google.com>,
Andi Kleen <andi@firstfloor.org>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Wang Nan <wangnan0@huawei.com>
Subject: [RFC/PATCH] perf report: Show random usage tip on the help line
Date: Tue, 5 Jan 2016 14:36:46 +0900 [thread overview]
Message-ID: <1451972206-22481-1-git-send-email-namhyung@kernel.org> (raw)
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.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/builtin-report.c | 2 +-
tools/perf/perf.c | 4 ++++
tools/perf/util/util.c | 22 ++++++++++++++++++++++
tools/perf/util/util.h | 2 ++
4 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index f10c663af996..c9cc15431a0f 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -433,7 +433,7 @@ static int report__browse_hists(struct report *rep)
int ret;
struct perf_session *session = rep->session;
struct perf_evlist *evlist = session->evlist;
- const char *help = "For a higher level overview, try: perf report --sort comm,dso";
+ const char *help = perf_report_tip();
switch (use_browser) {
case 1:
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 */
tracing_path_mount();
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index aff0cfd83662..09c6d6cb932b 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -663,3 +663,25 @@ fetch_kernel_version(unsigned int *puint, char *str,
*puint = (version << 16) + (patchlevel << 8) + sublevel;
return 0;
}
+
+const char *perf_report_tip(void)
+{
+ const char *tips[] = {
+ "For a higher level overview, try: perf report --sort comm,dso",
+ "Group related events with: perf record -e '{cycles,instructions}'",
+ "Compare performance with: perf diff [<old file> <new file>]",
+ "Boolean options have negative forms like: perf report --no-children",
+ "Customize output of perf script with: perf script -F event,ip,sym",
+ "Generate a script for your data: perf script -g <lang>",
+ "Save output of perf stat using: perf stat record",
+ "Create archive of data to see it on other machine: perf archive",
+ "Search options using a keyword: perf report -h filter",
+ "Use parent filter to see specific call path: perf report -p <regex>",
+ "listing interested events using substring match: perf list cpu",
+ "To see list of saved events and attributes: perf evlist -v",
+ "Use --symfs <dir> if your symbol files are in non-standard location",
+ "To see callchains in a more compact form: perf report -g folded",
+ };
+
+ return tips[random() % ARRAY_SIZE(tips)];
+}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 4b519c59bdc3..8e9cec4bf376 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -342,4 +342,6 @@ int fetch_kernel_version(unsigned int *puint,
#define KVER_FMT "%d.%d.%d"
#define KVER_PARAM(x) KVER_VERSION(x), KVER_PATCHLEVEL(x), KVER_SUBLEVEL(x)
+const char *perf_report_tip(void);
+
#endif /* GIT_COMPAT_UTIL_H */
--
2.6.4
next reply other threads:[~2016-01-05 5:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-05 5:36 Namhyung Kim [this message]
2016-01-05 6:32 ` Wangnan (F)
2016-01-05 10:43 ` Namhyung Kim
2016-01-05 16:40 ` Arnaldo Carvalho de Melo
2016-01-05 19:19 ` Namhyung Kim
2016-01-05 20:55 ` Arnaldo Carvalho de Melo
2016-01-05 20:59 ` Andi Kleen
2016-01-05 23:29 ` Namhyung Kim
2016-01-06 1:49 ` Arnaldo Carvalho de Melo
2016-01-05 20:52 ` Andi Kleen
2016-01-05 23:37 ` Namhyung Kim
2016-01-06 1:51 ` Arnaldo Carvalho de Melo
2016-01-08 15:41 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1451972206-22481-1-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=andi@firstfloor.org \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@kernel.org \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®