aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2016-11-21 16:33:31 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-11-23 08:44:06 -0500
commit3a5bfab60e59d9407b69f447702c4cd14326c825 (patch)
treeec4faf0cd28afdb3efad6a81b9220f917f1c4099 /tools
parentd940baccc990c29f0343843db7cf669bb8e91a6f (diff)
perf c2c: Support cascading options
Adding support for cascading options added by Namhyung in: commit 369a2478973a ("tools lib subcmd: Support cascading options") This way the report and record command share options with with c2c command and can save some option duplicates. For now it's the 'v' option. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Joe Mario <jmario@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1479764011-10732-7-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-c2c.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 54924717ae8e..4b419631753d 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -101,6 +101,11 @@ static const char *display_str[DISPLAY_MAX] = {
101 [DISPLAY_TOT] = "Total", 101 [DISPLAY_TOT] = "Total",
102}; 102};
103 103
104static const struct option c2c_options[] = {
105 OPT_INCR('v', "verbose", &verbose, "be more verbose (show counter open errors, etc)"),
106 OPT_END()
107};
108
104static struct perf_c2c c2c; 109static struct perf_c2c c2c;
105 110
106static void *c2c_he_zalloc(size_t size) 111static void *c2c_he_zalloc(size_t size)
@@ -2520,11 +2525,9 @@ static int perf_c2c__report(int argc, const char **argv)
2520 const char *display = NULL; 2525 const char *display = NULL;
2521 const char *coalesce = NULL; 2526 const char *coalesce = NULL;
2522 bool no_source = false; 2527 bool no_source = false;
2523 const struct option c2c_options[] = { 2528 const struct option options[] = {
2524 OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, 2529 OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
2525 "file", "vmlinux pathname"), 2530 "file", "vmlinux pathname"),
2526 OPT_INCR('v', "verbose", &verbose,
2527 "be more verbose (show counter open errors, etc)"),
2528 OPT_STRING('i', "input", &input_name, "file", 2531 OPT_STRING('i', "input", &input_name, "file",
2529 "the input file to process"), 2532 "the input file to process"),
2530 OPT_INCR('N', "node-info", &c2c.node_info, 2533 OPT_INCR('N', "node-info", &c2c.node_info,
@@ -2548,14 +2551,15 @@ static int perf_c2c__report(int argc, const char **argv)
2548 OPT_STRING('c', "coalesce", &coalesce, "coalesce fields", 2551 OPT_STRING('c', "coalesce", &coalesce, "coalesce fields",
2549 "coalesce fields: pid,tid,iaddr,dso"), 2552 "coalesce fields: pid,tid,iaddr,dso"),
2550 OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"), 2553 OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"),
2554 OPT_PARENT(c2c_options),
2551 OPT_END() 2555 OPT_END()
2552 }; 2556 };
2553 int err = 0; 2557 int err = 0;
2554 2558
2555 argc = parse_options(argc, argv, c2c_options, report_c2c_usage, 2559 argc = parse_options(argc, argv, options, report_c2c_usage,
2556 PARSE_OPT_STOP_AT_NON_OPTION); 2560 PARSE_OPT_STOP_AT_NON_OPTION);
2557 if (argc) 2561 if (argc)
2558 usage_with_options(report_c2c_usage, c2c_options); 2562 usage_with_options(report_c2c_usage, options);
2559 2563
2560 if (c2c.stats_only) 2564 if (c2c.stats_only)
2561 c2c.use_stdio = true; 2565 c2c.use_stdio = true;
@@ -2683,11 +2687,10 @@ static int perf_c2c__record(int argc, const char **argv)
2683 OPT_CALLBACK('e', "event", &event_set, "event", 2687 OPT_CALLBACK('e', "event", &event_set, "event",
2684 "event selector. Use 'perf mem record -e list' to list available events", 2688 "event selector. Use 'perf mem record -e list' to list available events",
2685 parse_record_events), 2689 parse_record_events),
2686 OPT_INCR('v', "verbose", &verbose,
2687 "be more verbose (show counter open errors, etc)"),
2688 OPT_BOOLEAN('u', "all-user", &all_user, "collect only user level data"), 2690 OPT_BOOLEAN('u', "all-user", &all_user, "collect only user level data"),
2689 OPT_BOOLEAN('k', "all-kernel", &all_kernel, "collect only kernel level data"), 2691 OPT_BOOLEAN('k', "all-kernel", &all_kernel, "collect only kernel level data"),
2690 OPT_UINTEGER('l', "ldlat", &perf_mem_events__loads_ldlat, "setup mem-loads latency"), 2692 OPT_UINTEGER('l', "ldlat", &perf_mem_events__loads_ldlat, "setup mem-loads latency"),
2693 OPT_PARENT(c2c_options),
2691 OPT_END() 2694 OPT_END()
2692 }; 2695 };
2693 2696
@@ -2759,11 +2762,6 @@ static int perf_c2c__record(int argc, const char **argv)
2759 2762
2760int cmd_c2c(int argc, const char **argv, const char *prefix __maybe_unused) 2763int cmd_c2c(int argc, const char **argv, const char *prefix __maybe_unused)
2761{ 2764{
2762 const struct option c2c_options[] = {
2763 OPT_INCR('v', "verbose", &verbose, "be more verbose"),
2764 OPT_END()
2765 };
2766
2767 argc = parse_options(argc, argv, c2c_options, c2c_usage, 2765 argc = parse_options(argc, argv, c2c_options, c2c_usage,
2768 PARSE_OPT_STOP_AT_NON_OPTION); 2766 PARSE_OPT_STOP_AT_NON_OPTION);
2769 2767