perf parser: Improve error message for PMU address filters
PATCH v2 1/1 perf parser: Improve error message for PMU address filters
This is the second version of a patch that improves the error message of the perf events parser when the PMU hardware does not support address filters.
Previously, the perf returned the following error:
Quoted 2 lines
$ perf record -e intel_pt// --filter 'filter sys_write' --filter option should follow a -e tracepoint or HW tracer option
This implies there is some syntax error present in the command line, which is not true. Rather, notify the user that the CPU does not have support for this feature.
For example, Intel chips based on the Broadwell micro-archticture have the Intel PT PMU, but do not support address filtering.
Now, perf prints the following error message:
Quoted 2 lines
$ perf record -e intel_pt// --filter 'filter sys_write' This CPU does not support address filtering
--- tools/perf/util/parse-events.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
tools/perf/util/parse-events.c +10 -10
@@ -1991,8 +1991,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)int nr_addr_filters =0 ;struct perf_pmu *pmu =NULL ; -if (evsel ==NULL ) - goto err; +if (evsel ==NULL ) { +fprintf (stderr, +"--filter option should follow a -e tracepoint or HW tracer option\n" ); +return -1 ; + }if (evsel->attr.type ==PERF_TYPE_TRACEPOINT ) {if (perf_evsel__append_tp_filter (evsel, str) <0 ) {
@@ -2014,8 +2017,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)perf_pmu__scan_file (pmu,"nr_addr_filters" ,"%d" , &nr_addr_filters); -if (!nr_addr_filters) - goto err; +if (!nr_addr_filters) { +fprintf (stderr, +"This CPU does not support address filtering\n" ); +return -1 ; + }if (perf_evsel__append_addr_filter (evsel, str) <0 ) { fprintf(stderr,
@@ -2024,12 +2030,6 @@ static int set_filter(struct perf_evsel *evsel, const void *arg) }return 0 ; - -err: -fprintf (stderr, -"--filter option should follow a -e tracepoint or HW tracer option\n" ); - -return -1 ; } int parse_filter(const struct option *opt, const char *str,
Signature · 1 line
2.18.0
Quoted 11 lines · Jack Henschel
This is the second version of a patch that improves the error message of the perf events parser when the PMU hardware does not support address filters.
Previously, the perf returned the following error:
Quoted 2 lines
$ perf record -e intel_pt// --filter 'filter sys_write' --filter option should follow a -e tracepoint or HW tracer optionThis implies there is some syntax error present in the command line, which is not true. Rather, notify the user that the CPU does not have support for this feature.
Quoted 8 lines
For example, Intel chips based on the Broadwell micro-archticture have the Intel PT PMU, but do not support address filtering.
Now, perf prints the following error message:
Quoted 2 lines
$ perf record -e intel_pt// --filter 'filter sys_write' This CPU does not support address filteringSigned-off-by Jack Henschel <[email protected]>
thanks,
jirka
Quoted 52 lines
--- tools/perf/util/parse-events.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)tools/perf/util/parse-events.c +10
-10@@ -1991,8 +1991,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)int nr_addr_filters =0 ;struct perf_pmu *pmu =NULL ; -if (evsel ==NULL ) - goto err; +if (evsel ==NULL ) { +fprintf (stderr, +"--filter option should follow a -e tracepoint or HW tracer option\n" ); +return -1 ; + }if (evsel->attr.type ==PERF_TYPE_TRACEPOINT ) {if (perf_evsel__append_tp_filter (evsel, str) <0 ) {@@ -2014,8 +2017,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)perf_pmu__scan_file (pmu,"nr_addr_filters" ,"%d" , &nr_addr_filters); -if (!nr_addr_filters) - goto err; +if (!nr_addr_filters) { +fprintf (stderr, +"This CPU does not support address filtering\n" ); +return -1 ; + }if (perf_evsel__append_addr_filter (evsel, str) <0 ) { fprintf(stderr,@@ -2024,12 +2030,6 @@ static int set_filter(struct perf_evsel *evsel, const void *arg) }return 0 ; - -err: -fprintf (stderr, -"--filter option should follow a -e tracepoint or HW tracer option\n" ); - -return -1 ; } int parse_filter(const struct option *opt, const char *str,Signature · 1 line
2.18.0
Arnaldo Carvalho de Melo
maintainerEm Wed, Jul 04, 2018 at 05:25:36PM +0200, Jiri Olsa escreveu:
Quoted 15 lines · Jack Henschel
Quoted 14 lines
This is the second version of a patch that improves the error message of the perf events parser when the PMU hardware does not support address filters.
Previously, the perf returned the following error:
Quoted 2 lines
$ perf record -e intel_pt// --filter 'filter sys_write' --filter option should follow a -e tracepoint or HW tracer optionThis implies there is some syntax error present in the command line, which is not true. Rather, notify the user that the CPU does not have support for this feature.
For example, Intel chips based on the Broadwell micro-archticture have the Intel PT PMU, but do not support address filtering.
Quoted 7 lines
Quoted 5 lines
Now, perf prints the following error message:
Quoted 2 lines
$ perf record -e intel_pt// --filter 'filter sys_write' This CPU does not support address filteringSigned-off-by Jack Henschel <[email protected]>Acked-by Jiri Olsa <[email protected]>
Thanks, tested and applied,
- Arnaldo
Quoted 55 lines
thanks,
jirkaQuoted 52 lines
--- tools/perf/util/parse-events.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)tools/perf/util/parse-events.c +10
-10@@ -1991,8 +1991,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)int nr_addr_filters =0 ;struct perf_pmu *pmu =NULL ; -if (evsel ==NULL ) - goto err; +if (evsel ==NULL ) { +fprintf (stderr, +"--filter option should follow a -e tracepoint or HW tracer option\n" ); +return -1 ; + }if (evsel->attr.type ==PERF_TYPE_TRACEPOINT ) {if (perf_evsel__append_tp_filter (evsel, str) <0 ) {@@ -2014,8 +2017,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)perf_pmu__scan_file (pmu,"nr_addr_filters" ,"%d" , &nr_addr_filters); -if (!nr_addr_filters) - goto err; +if (!nr_addr_filters) { +fprintf (stderr, +"This CPU does not support address filtering\n" ); +return -1 ; + }if (perf_evsel__append_addr_filter (evsel, str) <0 ) { fprintf(stderr,@@ -2024,12 +2030,6 @@ static int set_filter(struct perf_evsel *evsel, const void *arg) }return 0 ; - -err: -fprintf (stderr, -"--filter option should follow a -e tracepoint or HW tracer option\n" ); - -return -1 ; } int parse_filter(const struct option *opt, const char *str,Signature · 1 line
2.18.0
tip-bot for Jack Henschel
merge botperf parser: Improve error message for PMU address filters
Commit-ID: 49836f7811f383d8613661fff110ce74f4710d52 Gitweb: https://git.kernel.org/tip/49836f7811f383d8613661fff110ce74f4710d52 Author: Jack Henschel <[email protected]> AuthorDate: Wed, 4 Jul 2018 14:13:45 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 20 Aug 2018 08:54:58 -0300
perf parser: Improve error message for PMU address filters
This is the second version of a patch that improves the error message of the perf events parser when the PMU hardware does not support address filters.
Previously, the perf returned the following error:
$ perf record -e intel_pt// --filter 'filter sys_write' --filter option should follow a -e tracepoint or HW tracer option
This implies there is some syntax error present in the command line, which is not true. Rather, notify the user that the CPU does not have support for this feature.
For example, Intel chips based on the Broadwell micro-archticture have the Intel PT PMU, but do not support address filtering.
Now, perf prints the following error message:
$ perf record -e intel_pt// --filter 'filter sys_write' This CPU does not support address filtering
--- tools/perf/util/parse-events.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
tools/perf/util/parse-events.c +10 -10
@@ -1991,8 +1991,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)int nr_addr_filters =0 ;struct perf_pmu *pmu =NULL ; -if (evsel ==NULL ) - goto err; +if (evsel ==NULL ) { +fprintf (stderr, +"--filter option should follow a -e tracepoint or HW tracer option\n" ); +return -1 ; + }if (evsel->attr.type ==PERF_TYPE_TRACEPOINT ) {if (perf_evsel__append_tp_filter (evsel, str) <0 ) {
@@ -2014,8 +2017,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)perf_pmu__scan_file (pmu,"nr_addr_filters" ,"%d" , &nr_addr_filters); -if (!nr_addr_filters) - goto err; +if (!nr_addr_filters) { +fprintf (stderr, +"This CPU does not support address filtering\n" ); +return -1 ; + }if (perf_evsel__append_addr_filter (evsel, str) <0 ) { fprintf(stderr,
@@ -2024,12 +2030,6 @@ static int set_filter(struct perf_evsel *evsel, const void *arg) }return 0 ; - -err: -fprintf (stderr, -"--filter option should follow a -e tracepoint or HW tracer option\n" ); - -return -1 ; } int parse_filter(const struct option *opt, const char *str,