Skip to contentSkip to conversation

Some minor fixes for perf user tools

PATCH New Andi Kleen 4 participants 11 messages Apr 6, 2018 – Apr 21, 2018 perf events

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

This patchkit fixes some random minor issues in the perf user tools

-Andi

author
#1 lore raw

PATCH 1/4 perf, tools, mem: Allow all record/report options

From: Andi Kleen <[email protected]>

For perf mem report / perf mem record, pass all unknown options through to the underlying report/record commands. This makes things like

perf mem record -a sleep 1

work. Matches how c2c and other tools work.

---
 tools/perf/Documentation/perf-mem.txt | 3 +++
 tools/perf/builtin-mem.c              | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-mem.txt +3 -0
index b0211410969b..8806ed5f3802 100644
@@ -67,6 +67,9 @@ OPTIONS
 --phys-data::
 	Record/Report sample physical addresses
 
+In addition, for report all perf report options are valid, and for record
+all perf record options.
+
 SEE ALSO
 --------
 linkperf:perf-record[1], linkperf:perf-report[1]
tools/perf/builtin-mem.c +2 -2
index 506564651cda..57393e94d156 100644
@@ -83,7 +83,7 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
 	};
 
 	argc = parse_options(argc, argv, options, record_mem_usage,
-			     PARSE_OPT_STOP_AT_NON_OPTION);
+			     PARSE_OPT_KEEP_UNKNOWN);
 
 	rec_argc = argc + 9; /* max number of arguments */
 	rec_argv = calloc(rec_argc + 1, sizeof(char *));
@@ -436,7 +436,7 @@ int cmd_mem(int argc, const char **argv)
 	}
 
 	argc = parse_options_subcommand(argc, argv, mem_options, mem_subcommands,
-					mem_usage, PARSE_OPT_STOP_AT_NON_OPTION);
+					mem_usage, PARSE_OPT_KEEP_UNKNOWN);
 
 	if (!argc || !(strncmp(argv[0], "rec", 3) || mem.operation))
 		usage_with_options(mem_usage, mem_options);
Signature · 1 line
2.14.3
#2 lore raw

[tip:perf/urgent] perf mem: Allow all record/report options

perf mem: Allow all record/report options
Commit-ID:  a7e9eab3dbd35268c16244557a4155a2d9a641c3
Gitweb:     https://git.kernel.org/tip/a7e9eab3dbd35268c16244557a4155a2d9a641c3
Author:     Andi Kleen <[email protected]>
AuthorDate: Fri, 6 Apr 2018 13:38:09 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 18 Apr 2018 15:35:48 -0300

perf mem: Allow all record/report options

For perf mem report / perf mem record, pass all unknown options through to the underlying report/record commands. This makes things like

perf mem record -a sleep 1

work. Matches how c2c and other tools work.

---
 tools/perf/Documentation/perf-mem.txt | 3 +++
 tools/perf/builtin-mem.c              | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-mem.txt +3 -0
index b0211410969b..8806ed5f3802 100644
@@ -67,6 +67,9 @@ OPTIONS
 --phys-data::
 	Record/Report sample physical addresses
 
+In addition, for report all perf report options are valid, and for record
+all perf record options.
+
 SEE ALSO
 --------
 linkperf:perf-record[1], linkperf:perf-report[1]
tools/perf/builtin-mem.c +2 -2
index 506564651cda..57393e94d156 100644
@@ -83,7 +83,7 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
 	};
 
 	argc = parse_options(argc, argv, options, record_mem_usage,
-			     PARSE_OPT_STOP_AT_NON_OPTION);
+			     PARSE_OPT_KEEP_UNKNOWN);
 
 	rec_argc = argc + 9; /* max number of arguments */
 	rec_argv = calloc(rec_argc + 1, sizeof(char *));
@@ -436,7 +436,7 @@ int cmd_mem(int argc, const char **argv)
 	}
 
 	argc = parse_options_subcommand(argc, argv, mem_options, mem_subcommands,
-					mem_usage, PARSE_OPT_STOP_AT_NON_OPTION);
+					mem_usage, PARSE_OPT_KEEP_UNKNOWN);
 
 	if (!argc || !(strncmp(argv[0], "rec", 3) || mem.operation))
 		usage_with_options(mem_usage, mem_options);
author
#3 lore raw

PATCH 2/4 perf, tools: Clarify browser help

In reply to Andi Kleen

From: Andi Kleen <[email protected]>

Clarify in the browser help that ESC in tui mode may go back to the previous screen instead of just exiting (was not clear to me)

---
 tools/perf/ui/browsers/hists.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/ui/browsers/hists.c +1 -1
index 8b4e82548f8e..0abbc0048a8e 100644
@@ -2788,7 +2788,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 	"h/?/F1        Show this window\n"				\
 	"UP/DOWN/PGUP\n"						\
 	"PGDN/SPACE    Navigate\n"					\
-	"q/ESC/CTRL+C  Exit browser\n\n"				\
+	"q/ESC/CTRL+C  Exit browser or go back to previous screen\n\n"	\
 	"For multiple event sessions:\n\n"				\
 	"TAB/UNTAB     Switch events\n\n"				\
 	"For symbolic views (--sort has sym):\n\n"			\
Signature · 1 line
2.14.3
#4 lore raw

[tip:perf/urgent] perf hists browser: Clarify top/report browser help

perf hists browser: Clarify top/report browser help
Commit-ID:  6a02f06edea5a5910c787fd6c49b0552e8080e5d
Gitweb:     https://git.kernel.org/tip/6a02f06edea5a5910c787fd6c49b0552e8080e5d
Author:     Andi Kleen <[email protected]>
AuthorDate: Fri, 6 Apr 2018 13:38:10 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 18 Apr 2018 15:35:49 -0300

perf hists browser: Clarify top/report browser help

Clarify in the browser help that ESC in tui mode may go back to the previous screen instead of just exiting (was not clear to me)

---
 tools/perf/ui/browsers/hists.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/ui/browsers/hists.c +1 -1
index 0eec06c105c6..e5f247247daa 100644
@@ -2714,7 +2714,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 	"h/?/F1        Show this window\n"				\
 	"UP/DOWN/PGUP\n"						\
 	"PGDN/SPACE    Navigate\n"					\
-	"q/ESC/CTRL+C  Exit browser\n\n"				\
+	"q/ESC/CTRL+C  Exit browser or go back to previous screen\n\n"	\
 	"For multiple event sessions:\n\n"				\
 	"TAB/UNTAB     Switch events\n\n"				\
 	"For symbolic views (--sort has sym):\n\n"			\
author
#5 lore raw

PATCH 3/4 perf, tools, record: Remove misleading error suggestion

In reply to Andi Kleen

From: Andi Kleen <[email protected]>

When perf record encounters an error setting up an event it suggests to enable CONFIG_PERF_EVENTS. This is misleading because:
- Usually it is enabled (it is really hard to disable on x86)
- The problem is usually somewhere else, e.g. the CPU is not supported or an invalid configuration has been used.

Remove the misleading suggestion.

---
 tools/perf/util/evsel.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/evsel.c +1 -2
index 1ac8d9236efd..66b62570c855 100644
@@ -2894,8 +2894,7 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
 
 	return scnprintf(msg, size,
 	"The sys_perf_event_open() syscall returned with %d (%s) for event (%s).\n"
-	"/bin/dmesg may provide additional information.\n"
-	"No CONFIG_PERF_EVENTS=y kernel support configured?",
+	"/bin/dmesg | grep -i perf may provide additional information.\n",
 			 err, str_error_r(err, sbuf, sizeof(sbuf)),
 			 perf_evsel__name(evsel));
 }
Signature · 1 line
2.14.3
#6 lore raw

[tip:perf/urgent] perf record: Remove misleading error suggestion

perf record: Remove misleading error suggestion
Commit-ID:  ec3948451e0ba317e66873b48d6cc51d701d4eb0
Gitweb:     https://git.kernel.org/tip/ec3948451e0ba317e66873b48d6cc51d701d4eb0
Author:     Andi Kleen <[email protected]>
AuthorDate: Fri, 6 Apr 2018 13:38:11 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 18 Apr 2018 15:35:49 -0300

perf record: Remove misleading error suggestion

When perf record encounters an error setting up an event it suggests to enable CONFIG_PERF_EVENTS. This is misleading because:

- Usually it is enabled (it is really hard to disable on x86)

- The problem is usually somewhere else, e.g. the CPU is not supported or an invalid configuration has been used.

Remove the misleading suggestion.

---
 tools/perf/util/evsel.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/evsel.c +1 -2
index 1ac8d9236efd..66b62570c855 100644
@@ -2894,8 +2894,7 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
 
 	return scnprintf(msg, size,
 	"The sys_perf_event_open() syscall returned with %d (%s) for event (%s).\n"
-	"/bin/dmesg may provide additional information.\n"
-	"No CONFIG_PERF_EVENTS=y kernel support configured?",
+	"/bin/dmesg | grep -i perf may provide additional information.\n",
 			 err, str_error_r(err, sbuf, sizeof(sbuf)),
 			 perf_evsel__name(evsel));
 }
author
#7 lore raw

PATCH 4/4 perf, tools, record: Remove suggestion to enable APIC

In reply to Andi Kleen

From: Andi Kleen <[email protected]>

perf record suggests to enable the APIC on errors.

APIC is practically always used today and the problem is usually somewhere else.

Just remove the outdated suggestion.

---
 tools/perf/util/evsel.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/evsel.c +1 -2
index 66b62570c855..3e87486c28fe 100644
@@ -2870,8 +2870,7 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
 #if defined(__i386__) || defined(__x86_64__)
 		if (evsel->attr.type == PERF_TYPE_HARDWARE)
 			return scnprintf(msg, size, "%s",
-	"No hardware sampling interrupt available.\n"
-	"No APIC? If so then you can boot the kernel with the \"lapic\" boot parameter to force-enable it.");
+	"No hardware sampling interrupt available.\n");
 #endif
 		break;
 	case EBUSY:
Signature · 1 line
2.14.3
#8 lore raw

[tip:perf/urgent] perf record: Remove suggestion to enable APIC

perf record: Remove suggestion to enable APIC
Commit-ID:  ccbb6afe0890b09cc828373a9a5fffab40ec85df
Gitweb:     https://git.kernel.org/tip/ccbb6afe0890b09cc828373a9a5fffab40ec85df
Author:     Andi Kleen <[email protected]>
AuthorDate: Fri, 6 Apr 2018 13:38:12 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 18 Apr 2018 15:35:50 -0300

perf record: Remove suggestion to enable APIC

'perf record' suggests to enable the APIC on errors.

APIC is practically always used today and the problem is usually somewhere else.

Just remove the outdated suggestion.

---
 tools/perf/util/evsel.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/evsel.c +1 -2
index 66b62570c855..3e87486c28fe 100644
@@ -2870,8 +2870,7 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
 #if defined(__i386__) || defined(__x86_64__)
 		if (evsel->attr.type == PERF_TYPE_HARDWARE)
 			return scnprintf(msg, size, "%s",
-	"No hardware sampling interrupt available.\n"
-	"No APIC? If so then you can boot the kernel with the \"lapic\" boot parameter to force-enable it.");
+	"No hardware sampling interrupt available.\n");
 #endif
 		break;
 	case EBUSY: