[PATCH] perf mem: Show perf mem report usage by -h option

From: Sangwon Hong
Date: Tue Feb 06 2018 - 13:47:55 EST


When typing 'perf mem report -h', the result showed 'perf report' usage.
So change to show 'perf mem report' usage.

Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Taeung Song <treeze.taeung@xxxxxxxxx>
Signed-off-by: Sangwon Hong <qpakzk@xxxxxxxxx>
---
tools/perf/builtin-mem.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 5065646..311fbed 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -314,6 +314,25 @@ static int report_events(int argc, const char **argv, struct perf_mem *mem)
return ret;
}

+static int __cmd_report(int argc, const char **argv, struct perf_mem *mem)
+{
+ int argc2;
+ const char *mem_report_usage[] = {
+ "perf mem [<options>] report",
+ NULL
+ };
+ struct option options[] = {
+ OPT_END()
+ };
+
+ argc2 = parse_options(argc, argv, options, mem_report_usage,
+ PARSE_OPT_STOP_AT_NON_OPTION);
+ if (argc2)
+ usage_with_options(mem_report_usage, options);
+
+ return report_events(argc, argv, mem);
+}
+
struct mem_mode {
const char *name;
int mode;
@@ -451,7 +470,7 @@ int cmd_mem(int argc, const char **argv)
if (!strncmp(argv[0], "rec", 3))
return __cmd_record(argc, argv, &mem);
else if (!strncmp(argv[0], "rep", 3))
- return report_events(argc, argv, &mem);
+ return __cmd_report(argc, argv, &mem);
else
usage_with_options(mem_usage, mem_options);

--
2.7.4