[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fe5fb278-ca58-d344-4f0e-a1c4cca5c210@huawei.com>
Date: Fri, 5 Feb 2021 09:56:17 +0000
From: John Garry <john.garry@...wei.com>
To: Jiri Olsa <jolsa@...hat.com>
CC: Joakim Zhang <qiangqing.zhang@....com>,
"peterz@...radead.org" <peterz@...radead.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"acme@...nel.org" <acme@...nel.org>,
"mark.rutland@....com" <mark.rutland@....com>,
"alexander.shishkin@...ux.intel.com"
<alexander.shishkin@...ux.intel.com>,
"namhyung@...nel.org" <namhyung@...nel.org>,
"irogers@...gle.com" <irogers@...gle.com>,
"kjain@...ux.ibm.com" <kjain@...ux.ibm.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linuxarm@...neuler.org" <linuxarm@...neuler.org>
Subject: Re: [PATCH] perf metricgroup: Fix system PMU metrics
>>
>>
> that's fixing the issue for me, this was crashing:
> # perf stat -a -I 1000 -M L1D_Cache_Fill_BW,L2_Cache_Fill_BW
>
To cover this scenario (multiple metrics listed), how about a simple
addition like:
---->8----
From bd2ded1b0ef4962a9443cd180eed4e5c5b75ae5f Mon Sep 17 00:00:00 2001
From: John Garry <john.garry@...wei.com>
Date: Fri, 5 Feb 2021 09:50:54 +0000
Subject: [PATCH] perf test: Add parse-metric list test scenario
diff --git a/tools/perf/tests/parse-metric.c
b/tools/perf/tests/parse-metric.c
index ce7be37f0d88..0626e389354c 100644
--- a/tools/perf/tests/parse-metric.c
+++ b/tools/perf/tests/parse-metric.c
@@ -201,6 +201,13 @@ static int compute_metric_group(const char *name,
struct value *vals,
return __compute_metric(name, vals, name1, ratio1, name2, ratio2);
}
+static int compute_metric_list(const char *list, struct value *vals,
+ const char *name1, double *ratio1,
+ const char *name2, double *ratio2)
+{
+ return __compute_metric(list, vals, name1, ratio1, name2, ratio2);
+}
+
static int test_ipc(void)
{
double ratio;
@@ -279,7 +286,7 @@ static int test_cache_miss_cycles(void)
*/
static int test_dcache_l2(void)
{
- double ratio;
+ double ratio, ratio1, ratio2;
struct value vals[] = {
{ .event = "l2_rqsts.demand_data_rd_hit", .val = 100 },
{ .event = "l2_rqsts.pf_hit", .val = 200 },
@@ -301,6 +308,15 @@ static int test_dcache_l2(void)
TEST_ASSERT_VAL("DCache_L2_Misses failed, wrong ratio",
ratio == 0.7);
+
+ TEST_ASSERT_VAL("failed to compute metric",
+ compute_metric_list("DCache_L2_Hits,DCache_L2_Misses", vals,
"DCache_L2_Hits", &ratio1, "DCache_L2_Misses", &ratio2) == 0);
+
+ TEST_ASSERT_VAL("DCache_L2_Hits failed, wrong ratio",
+ ratio1 == 0.3);
+
+ TEST_ASSERT_VAL("DCache_L2_Misses failed, wrong ratio",
+ ratio2 == 0.7);
return 0;
}
----8<----
> could you please send it formaly, so it can be merged?
>
> I can't reproduce the original patch issue and I need
> to check the code in more depth
Thanks,
John
Powered by blists - more mailing lists