From: Shunsuke Nakamura <nakamura.shun@fujitsu.com> To: john.garry@huawei.com, will@kernel.org, mathieu.poirier@linaro.org, leo.yan@linaro.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 4/4] perf test: Add test for event name starting with a number Date: Thu, 4 Mar 2021 12:26:10 +0900 [thread overview] Message-ID: <20210304032610.3112996-5-nakamura.shun@fujitsu.com> (raw) In-Reply-To: <20210304032610.3112996-1-nakamura.shun@fujitsu.com> From: Shunsuke Nakamura <nakamura.shun@jp.fujitsu.com> Add test for event name starting with a number. This test pattern checks that event names starting with a number do not result in a 'parse error'. Committer notes: Testing arm64 and x86: # ./perf test fake 10: PMU events : 10.4: Parsing of PMU event table metrics with fake PMUs : Ok # ./perf test fake -vv parsing metric: 0inst_commit + 1inst_commit + 2inst_commit + 3inst_commit + 4inst_commit Attempting to add event pmu '4inst_commit' with '' that may result in non-fatal errors Attempting to add event pmu '0inst_commit' with '' that may result in non-fatal errors Attempting to add event pmu '2inst_commit' with '' that may result in non-fatal errors Attempting to add event pmu '3inst_commit' with '' that may result in non-fatal errors Attempting to add event pmu '1inst_commit' with '' that may result in non-fatal errors parsing metric: 0inst_commit + 1inst_commit + 2inst_commit + 3inst_commit + 4inst_commit lookup(0inst_commit): val 2.000000 lookup(1inst_commit): val 5.000000 lookup(2inst_commit): val 3.000000 lookup(3inst_commit): val 4.000000 lookup(4inst_commit): val 1.000000 test child finished with 0 ---- end ---- PMU events subtest 4: Ok Signed-off-by: Shunsuke Nakamura <nakamura.shun@fujitsu.com> --- tools/perf/tests/pmu-events.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/tools/perf/tests/pmu-events.c b/tools/perf/tests/pmu-events.c index 0ca6a5a53523..1a95080373ee 100644 --- a/tools/perf/tests/pmu-events.c +++ b/tools/perf/tests/pmu-events.c @@ -398,27 +398,12 @@ static int test_aliases(void) return 0; } -static bool is_number(const char *str) -{ - char *end_ptr; - double v; - - errno = 0; - v = strtod(str, &end_ptr); - (void)v; // We're not interested in this value, only if it is valid - return errno == 0 && end_ptr != str; -} - static int check_parse_id(const char *id, struct parse_events_error *error, struct perf_pmu *fake_pmu) { struct evlist *evlist; int ret; - /* Numbers are always valid. */ - if (is_number(id)) - return 0; - evlist = evlist__new(); if (!evlist) return -ENOMEM; @@ -540,6 +525,7 @@ static struct test_metric metrics[] = { { "imx8_ddr0@axid\\-read\\,axi_mask\\=0xffff\\,axi_id\\=0x0000@ * 4", }, { "(cstate_pkg@c2\\-residency@ / msr@tsc@) * 100", }, { "(imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@)", }, + { "0inst_commit + 1inst_commit + 2inst_commit + 3inst_commit + 4inst_commit",} , }; static int metric_parse_fake(const char *str) -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Shunsuke Nakamura <nakamura.shun@fujitsu.com> To: john.garry@huawei.com, will@kernel.org, mathieu.poirier@linaro.org, leo.yan@linaro.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 4/4] perf test: Add test for event name starting with a number Date: Thu, 4 Mar 2021 12:26:10 +0900 [thread overview] Message-ID: <20210304032610.3112996-5-nakamura.shun@fujitsu.com> (raw) In-Reply-To: <20210304032610.3112996-1-nakamura.shun@fujitsu.com> From: Shunsuke Nakamura <nakamura.shun@jp.fujitsu.com> Add test for event name starting with a number. This test pattern checks that event names starting with a number do not result in a 'parse error'. Committer notes: Testing arm64 and x86: # ./perf test fake 10: PMU events : 10.4: Parsing of PMU event table metrics with fake PMUs : Ok # ./perf test fake -vv parsing metric: 0inst_commit + 1inst_commit + 2inst_commit + 3inst_commit + 4inst_commit Attempting to add event pmu '4inst_commit' with '' that may result in non-fatal errors Attempting to add event pmu '0inst_commit' with '' that may result in non-fatal errors Attempting to add event pmu '2inst_commit' with '' that may result in non-fatal errors Attempting to add event pmu '3inst_commit' with '' that may result in non-fatal errors Attempting to add event pmu '1inst_commit' with '' that may result in non-fatal errors parsing metric: 0inst_commit + 1inst_commit + 2inst_commit + 3inst_commit + 4inst_commit lookup(0inst_commit): val 2.000000 lookup(1inst_commit): val 5.000000 lookup(2inst_commit): val 3.000000 lookup(3inst_commit): val 4.000000 lookup(4inst_commit): val 1.000000 test child finished with 0 ---- end ---- PMU events subtest 4: Ok Signed-off-by: Shunsuke Nakamura <nakamura.shun@fujitsu.com> --- tools/perf/tests/pmu-events.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/tools/perf/tests/pmu-events.c b/tools/perf/tests/pmu-events.c index 0ca6a5a53523..1a95080373ee 100644 --- a/tools/perf/tests/pmu-events.c +++ b/tools/perf/tests/pmu-events.c @@ -398,27 +398,12 @@ static int test_aliases(void) return 0; } -static bool is_number(const char *str) -{ - char *end_ptr; - double v; - - errno = 0; - v = strtod(str, &end_ptr); - (void)v; // We're not interested in this value, only if it is valid - return errno == 0 && end_ptr != str; -} - static int check_parse_id(const char *id, struct parse_events_error *error, struct perf_pmu *fake_pmu) { struct evlist *evlist; int ret; - /* Numbers are always valid. */ - if (is_number(id)) - return 0; - evlist = evlist__new(); if (!evlist) return -ENOMEM; @@ -540,6 +525,7 @@ static struct test_metric metrics[] = { { "imx8_ddr0@axid\\-read\\,axi_mask\\=0xffff\\,axi_id\\=0x0000@ * 4", }, { "(cstate_pkg@c2\\-residency@ / msr@tsc@) * 100", }, { "(imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@)", }, + { "0inst_commit + 1inst_commit + 2inst_commit + 3inst_commit + 4inst_commit",} , }; static int metric_parse_fake(const char *str) -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-03-04 3:34 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-04 3:26 [PATCH v7 0/4] perf vendor events: Support PMU events for A64FX Shunsuke Nakamura 2021-03-04 3:26 ` Shunsuke Nakamura 2021-03-04 3:26 ` [PATCH v7 1/4] perf vendor events arm64: Add more common and uarch events Shunsuke Nakamura 2021-03-04 3:26 ` Shunsuke Nakamura 2021-03-04 3:26 ` [PATCH v7 2/4] perf tools: Add lexical definition of event name Shunsuke Nakamura 2021-03-04 3:26 ` Shunsuke Nakamura 2021-03-04 9:34 ` John Garry 2021-03-04 9:34 ` John Garry 2021-03-05 10:09 ` nakamura.shun 2021-03-05 10:09 ` nakamura.shun 2021-03-06 19:14 ` Jiri Olsa 2021-03-06 19:14 ` Jiri Olsa 2021-03-08 3:19 ` nakamura.shun 2021-03-08 3:19 ` nakamura.shun 2021-03-04 3:26 ` [PATCH v7 3/4] perf vendor events arm64: Add Fujitsu A64FX pmu event Shunsuke Nakamura 2021-03-04 3:26 ` Shunsuke Nakamura 2021-03-04 3:26 ` Shunsuke Nakamura [this message] 2021-03-04 3:26 ` [PATCH v7 4/4] perf test: Add test for event name starting with a number Shunsuke Nakamura
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210304032610.3112996-5-nakamura.shun@fujitsu.com \ --to=nakamura.shun@fujitsu.com \ --cc=acme@kernel.org \ --cc=alexander.shishkin@linux.intel.com \ --cc=john.garry@huawei.com \ --cc=jolsa@redhat.com \ --cc=leo.yan@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=mathieu.poirier@linaro.org \ --cc=mingo@redhat.com \ --cc=namhyung@kernel.org \ --cc=peterz@infradead.org \ --cc=will@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.