Skip to contentSkip to conversation

perf annotate: Period and samples view can't be used at the same time

PATCH Superseded Taeung Song 1 participant 1 message Aug 15, 2017 perf events

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/4 perf annotate: Period and samples view can't be used at the same time

If users give two options --show-total-period and --show-nr-samples, show their proper usage because the two options can not be used at the same time.

Cc Namhyung Kim <[email protected]>
Cc Jiri Olsa <[email protected]>
---
 tools/perf/builtin-annotate.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/builtin-annotate.c +6 -2
index acde4cc..9d25c27 100644
@@ -403,7 +403,7 @@ int cmd_annotate(int argc, const char **argv)
 	struct perf_data_file file = {
 		.mode  = PERF_DATA_MODE_READ,
 	};
-	const struct option options[] = {
+	struct option options[] = {
 	OPT_STRING('i', "input", &input_name, "file",
 		    "input file name"),
 	OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]",
@@ -452,8 +452,12 @@ int cmd_annotate(int argc, const char **argv)
 			     stdio__config_color, "always"),
 	OPT_END()
 	};
-	int ret = hists__init();
+	int ret;
+
+	set_option_flag(options, 0, "show-total-period", PARSE_OPT_EXCLUSIVE);
+	set_option_flag(options, 0, "show-nr-samples", PARSE_OPT_EXCLUSIVE);
 
+	ret = hists__init();
 	if (ret < 0)
 		return ret;
 
Signature · 1 line
2.7.4