diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2022-08-09 11:07:02 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-08-10 14:30:09 -0300 |
commit | 806731a9465b42aaf887cbaf8bfee7eccc9417de (patch) | |
tree | 7a1cf71e17d762a0f7dffd5c473b999d20147ff6 /tools/perf/tests | |
parent | 1da1d60774014137d776d0400fdf2f1779d8d4d5 (diff) |
perf tools: Do not pass NULL to parse_events()
Many cases do not use the extra error information provided by
parse_events and instead pass NULL as the struct parse_events_error
pointer. Add a wrapper for those cases so that the pointer is never
NULL.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20220809080702.6921-4-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests')
-rw-r--r-- | tools/perf/tests/code-reading.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/event-times.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/evsel-roundtrip-name.c | 4 | ||||
-rw-r--r-- | tools/perf/tests/hists_cumulate.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/hists_filter.c | 4 | ||||
-rw-r--r-- | tools/perf/tests/hists_link.c | 4 | ||||
-rw-r--r-- | tools/perf/tests/hists_output.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/keep-tracking.c | 4 | ||||
-rw-r--r-- | tools/perf/tests/perf-time-to-tsc.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/switch-tracking.c | 12 |
10 files changed, 19 insertions, 19 deletions
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 5610767b407f..95feb6ef34a0 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c @@ -638,7 +638,7 @@ static int do_test_code_reading(bool try_kcore) str = do_determine_event(excl_kernel); pr_debug("Parsing event '%s'\n", str); - ret = parse_events(evlist, str, NULL); + ret = parse_event(evlist, str); if (ret < 0) { pr_debug("parse_events failed\n"); goto out_put; diff --git a/tools/perf/tests/event-times.c b/tools/perf/tests/event-times.c index 7606eb3df92f..e155f0e0e04d 100644 --- a/tools/perf/tests/event-times.c +++ b/tools/perf/tests/event-times.c @@ -174,7 +174,7 @@ static int test_times(int (attach)(struct evlist *), goto out_err; } - err = parse_events(evlist, "cpu-clock:u", NULL); + err = parse_event(evlist, "cpu-clock:u"); if (err) { pr_debug("failed to parse event cpu-clock:u\n"); goto out_err; diff --git a/tools/perf/tests/evsel-roundtrip-name.c b/tools/perf/tests/evsel-roundtrip-name.c index 9d3c64974f77..e94fed901992 100644 --- a/tools/perf/tests/evsel-roundtrip-name.c +++ b/tools/perf/tests/evsel-roundtrip-name.c @@ -27,7 +27,7 @@ static int perf_evsel__roundtrip_cache_name_test(void) for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) { __evsel__hw_cache_type_op_res_name(type, op, i, name, sizeof(name)); - err = parse_events(evlist, name, NULL); + err = parse_event(evlist, name); if (err) ret = err; } @@ -75,7 +75,7 @@ static int __perf_evsel__name_array_test(const char *const names[], int nr_names return -ENOMEM; for (i = 0; i < nr_names; ++i) { - err = parse_events(evlist, names[i], NULL); + err = parse_event(evlist, names[i]); if (err) { pr_debug("failed to parse event '%s', err %d\n", names[i], err); diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c index 17f4fcd6bdce..b42d37ff2399 100644 --- a/tools/perf/tests/hists_cumulate.c +++ b/tools/perf/tests/hists_cumulate.c @@ -706,7 +706,7 @@ static int test__hists_cumulate(struct test_suite *test __maybe_unused, int subt TEST_ASSERT_VAL("No memory", evlist); - err = parse_events(evlist, "cpu-clock", NULL); + err = parse_event(evlist, "cpu-clock"); if (err) goto out; err = TEST_FAIL; diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c index 08cbeb9e39ae..8e1ceeb9b7b6 100644 --- a/tools/perf/tests/hists_filter.c +++ b/tools/perf/tests/hists_filter.c @@ -111,10 +111,10 @@ static int test__hists_filter(struct test_suite *test __maybe_unused, int subtes TEST_ASSERT_VAL("No memory", evlist); - err = parse_events(evlist, "cpu-clock", NULL); + err = parse_event(evlist, "cpu-clock"); if (err) goto out; - err = parse_events(evlist, "task-clock", NULL); + err = parse_event(evlist, "task-clock"); if (err) goto out; err = TEST_FAIL; diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c index c575e13a850d..14b2ff808b5e 100644 --- a/tools/perf/tests/hists_link.c +++ b/tools/perf/tests/hists_link.c @@ -276,10 +276,10 @@ static int test__hists_link(struct test_suite *test __maybe_unused, int subtest if (evlist == NULL) return -ENOMEM; - err = parse_events(evlist, "cpu-clock", NULL); + err = parse_event(evlist, "cpu-clock"); if (err) goto out; - err = parse_events(evlist, "task-clock", NULL); + err = parse_event(evlist, "task-clock"); if (err) goto out; diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c index 0bde4a768c15..62b0093253e3 100644 --- a/tools/perf/tests/hists_output.c +++ b/tools/perf/tests/hists_output.c @@ -593,7 +593,7 @@ static int test__hists_output(struct test_suite *test __maybe_unused, int subtes TEST_ASSERT_VAL("No memory", evlist); - err = parse_events(evlist, "cpu-clock", NULL); + err = parse_event(evlist, "cpu-clock"); if (err) goto out; err = TEST_FAIL; diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c index dd2067312452..8f4f9b632e1e 100644 --- a/tools/perf/tests/keep-tracking.c +++ b/tools/perf/tests/keep-tracking.c @@ -89,8 +89,8 @@ static int test__keep_tracking(struct test_suite *test __maybe_unused, int subte perf_evlist__set_maps(&evlist->core, cpus, threads); - CHECK__(parse_events(evlist, "dummy:u", NULL)); - CHECK__(parse_events(evlist, "cycles:u", NULL)); + CHECK__(parse_event(evlist, "dummy:u")); + CHECK__(parse_event(evlist, "cycles:u")); evlist__config(evlist, &opts, NULL); diff --git a/tools/perf/tests/perf-time-to-tsc.c b/tools/perf/tests/perf-time-to-tsc.c index 7c7d20fc503a..26ce30a35191 100644 --- a/tools/perf/tests/perf-time-to-tsc.c +++ b/tools/perf/tests/perf-time-to-tsc.c @@ -100,7 +100,7 @@ static int test__perf_time_to_tsc(struct test_suite *test __maybe_unused, int su perf_evlist__set_maps(&evlist->core, cpus, threads); - CHECK__(parse_events(evlist, "cycles:u", NULL)); + CHECK__(parse_event(evlist, "cycles:u")); evlist__config(evlist, &opts, NULL); diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c index 6f53bee33f7c..2d46af9ef935 100644 --- a/tools/perf/tests/switch-tracking.c +++ b/tools/perf/tests/switch-tracking.c @@ -364,7 +364,7 @@ static int test__switch_tracking(struct test_suite *test __maybe_unused, int sub perf_evlist__set_maps(&evlist->core, cpus, threads); /* First event */ - err = parse_events(evlist, "cpu-clock:u", NULL); + err = parse_event(evlist, "cpu-clock:u"); if (err) { pr_debug("Failed to parse event dummy:u\n"); goto out_err; @@ -375,14 +375,14 @@ static int test__switch_tracking(struct test_suite *test __maybe_unused, int sub /* Second event */ if (perf_pmu__has_hybrid()) { cycles = "cpu_core/cycles/u"; - err = parse_events(evlist, cycles, NULL); + err = parse_event(evlist, cycles); if (err) { cycles = "cpu_atom/cycles/u"; pr_debug("Trying %s\n", cycles); - err = parse_events(evlist, cycles, NULL); + err = parse_event(evlist, cycles); } } else { - err = parse_events(evlist, cycles, NULL); + err = parse_event(evlist, cycles); } if (err) { pr_debug("Failed to parse event %s\n", cycles); @@ -398,7 +398,7 @@ static int test__switch_tracking(struct test_suite *test __maybe_unused, int sub goto out; } - err = parse_events(evlist, sched_switch, NULL); + err = parse_event(evlist, sched_switch); if (err) { pr_debug("Failed to parse event %s\n", sched_switch); goto out_err; @@ -428,7 +428,7 @@ static int test__switch_tracking(struct test_suite *test __maybe_unused, int sub evsel__set_sample_bit(cycles_evsel, TIME); /* Fourth event */ - err = parse_events(evlist, "dummy:u", NULL); + err = parse_event(evlist, "dummy:u"); if (err) { pr_debug("Failed to parse event dummy:u\n"); goto out_err; |