lkml.org 
[lkml]   [2021]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] perf metricgroup: Fix system PMU metrics
From
Date

>>
>>
> 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@huawei.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

\
 
 \ /
  Last update: 2021-02-06 01:56    [W:0.175 / U:2.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site