Skip to contentSkip to conversation

perf config: Show the configuration when no arguments are provided

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Dec 20, 2018 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  41e0d040c475251eea14c8b92ea3a01c5e269856
Gitweb:     https://git.kernel.org/tip/41e0d040c475251eea14c8b92ea3a01c5e269856
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Fri, 14 Dec 2018 10:29:44 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 18 Dec 2018 12:24:00 -0300

perf config: Show the configuration when no arguments are provided

More convenient thah having to recall what letter is about showing/listing/dumping the configuration, i.e. no arguments means -l/--list:

  # perf config
  llvm.dump-obj=true
  trace.default_events=/home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
  trace.show_zeros=yes
  trace.show_duration=no
  # perf config -l
  llvm.dump-obj=true
  trace.default_events=/home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
  trace.show_zeros=yes
  trace.show_duration=no
  # perf config -h

Usage: perf config [<file-option>] [options] [section.name[=value] ...]

      -l, --list            show current config variables
          --system          use system config file
          --user            use user config file

#

---
 tools/perf/builtin-config.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
tools/perf/builtin-config.c +3 -4
index 514f70f95b57..d76f831f94c7 100644
@@ -196,6 +196,7 @@ int cmd_config(int argc, const char **argv)
 			pr_err("Error: takes no arguments\n");
 			parse_options_usage(config_usage, config_options, "l", 1);
 		} else {
+do_action_list:
 			if (show_config(set) < 0) {
 				pr_err("Nothing configured, "
 				       "please check your %s \n", config_filename);
@@ -204,10 +205,8 @@ int cmd_config(int argc, const char **argv)
 		}
 		break;
 	default:
-		if (!argc) {
-			usage_with_options(config_usage, config_options);
-			break;
-		}
+		if (!argc)
+			goto do_action_list;
 
 		for (i = 0; argv[i]; i++) {
 			char *var, *value;