Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2302264ybt; Sun, 28 Jun 2020 15:02:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzZmqvJAmUTdsKyNs1d7JbeJc/i3f55hYQUM3yHLT5w2ToQCZcA0IJ3zk07eLQZxdUi3Ob X-Received: by 2002:a05:6402:2c5:: with SMTP id b5mr1865527edx.316.1593381745424; Sun, 28 Jun 2020 15:02:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593381745; cv=none; d=google.com; s=arc-20160816; b=HBSg2YYzufNClVh7IADTARl+okK0E2EdvpAwfs7M4sDFPBNGyr1yp7wHpQuSi7wYfw v63MMqoUxw67/VZIhoNJHVAf0fxezaohPDUZQAL4zZSLpFrrIu8OdlSqdYjFgoBQ1U0t 7j2xJFcF+YgVqU3U3sMWMaVoMO3ySNheQhPJIe83/QuDXOXBiS6Lgb6yhY2MEZRAzFY3 IJvCPvXCz/h48qbSKQFttMb2xHMeYIQfpt6dyG/bpemkR7rN9CFQQc2VtWjIzS2DIxnE k586EAUH9rb3FT7VbCtRQIcaAPAbX0nBUx33FYiIWG3HG9VYMPevoeNtVTQyszUnfFSh uutg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=E4aw2LV4QYh3CzKLGA3AMNwowiWBppLOoNKVxSBZvo4=; b=kH3Fvbd6CuWAQ8SELq9O7psRYdWdOFhH7O4aTqN6yL7PeXi5W3LbQ2c46s03vF3UJ3 RrQNW2nNt/3abW9kLjCKIADUCbUIHnPCTT1Oct8C+/H+XzTh86CsirRZQitW+2GMaYQH M5lrxoc9WYx3ru6Qm75ujzJByuYggc78lY5lwT61ZeMlOp9iWe91lGKkzrHXxPaK1aZG SXR05wg38wtkGSgr/CGcnrisRPOYr7YS+BqRjiGTzz+nwgjzvmmuruCuHpKpFGGUIMK9 FCYkgbgd72K6ZSH9z5iwWIY75/Jxgp3o3WuU4TGZ2yFyX/2UU6jtRzu74zuutVcDcWSe nhEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P6lCAmsF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si2954483edv.119.2020.06.28.15.02.02; Sun, 28 Jun 2020 15:02:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P6lCAmsF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726493AbgF1WBL (ORCPT + 99 others); Sun, 28 Jun 2020 18:01:11 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28154 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726080AbgF1WBK (ORCPT ); Sun, 28 Jun 2020 18:01:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593381669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=E4aw2LV4QYh3CzKLGA3AMNwowiWBppLOoNKVxSBZvo4=; b=P6lCAmsFNiqOBrq7vhW5fEm5zBxfYLhq0rjAEJ/8JbAXviW10Cbet4Zd0+tbqsyesecUFv xp3J8FxRkV7umuiNEK0vZimCthvH8RhH/FPl0ehXJOlMTxUiqVD8JQasXTOPaexgsgWQ1Y 3pIwezcg7Em9Ig9TvUn8y/KMZU/KKlE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-502-SZJSy8bEMTyuRmVzYXGYNA-1; Sun, 28 Jun 2020 18:01:04 -0400 X-MC-Unique: SZJSy8bEMTyuRmVzYXGYNA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D70CB804001; Sun, 28 Jun 2020 22:01:02 +0000 (UTC) Received: from krava (unknown [10.40.192.56]) by smtp.corp.redhat.com (Postfix) with SMTP id 022FF9CFD2; Sun, 28 Jun 2020 22:00:59 +0000 (UTC) Date: Mon, 29 Jun 2020 00:00:59 +0200 From: Jiri Olsa To: Ian Rogers Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Andi Kleen , Kajol Jain , John Garry , "Paul A. Clarke" , Stephane Eranian Subject: Re: [PATCH 10/10] perf tests: Add cache_miss_cycles to metric parse test Message-ID: <20200628220059.GP2988321@krava> References: <20200626194720.2915044-1-jolsa@kernel.org> <20200626194720.2915044-11-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 26, 2020 at 02:40:34PM -0700, Ian Rogers wrote: > On Fri, Jun 26, 2020 at 12:48 PM Jiri Olsa wrote: > > > > Adding test that compute metric with other metrics in it. > > > > cache_miss_cycles = metric:dcache_miss_cpi + metric:icache_miss_cycles > > > > This is really nice! Do we need to do anything in tests/pmu-events.c? > Presumably if a metric is referencing another metric the call to > expr__parse there will test the other metric is parseable. Just wanted > to sanity check. right, I did not realize that, but that test is passing for me, so I guess it's fine.. I'll double check thanks, jirka > > Acked-by: Ian Rogers > > > Signed-off-by: Jiri Olsa > > --- > > tools/perf/tests/parse-metric.c | 33 +++++++++++++++++++++++++++++++++ > > 1 file changed, 33 insertions(+) > > > > diff --git a/tools/perf/tests/parse-metric.c b/tools/perf/tests/parse-metric.c > > index 8c48251425e1..feb97f7c90c8 100644 > > --- a/tools/perf/tests/parse-metric.c > > +++ b/tools/perf/tests/parse-metric.c > > @@ -11,6 +11,8 @@ > > #include "debug.h" > > #include "expr.h" > > #include "stat.h" > > +#include > > +#include > > > > static struct pmu_event pme_test[] = { > > { > > @@ -22,6 +24,18 @@ static struct pmu_event pme_test[] = { > > "( 1 + cpu_clk_unhalted.one_thread_active / cpu_clk_unhalted.ref_xclk ) )))", > > .metric_name = "Frontend_Bound_SMT", > > }, > > +{ > > + .metric_expr = "l1d\\-loads\\-misses / inst_retired.any", > > + .metric_name = "dcache_miss_cpi", > > +}, > > +{ > > + .metric_expr = "l1i\\-loads\\-misses / inst_retired.any", > > + .metric_name = "icache_miss_cycles", > > +}, > > +{ > > + .metric_expr = "(metric:dcache_miss_cpi + metric:icache_miss_cycles)", > > + .metric_name = "cache_miss_cycles", > > +}, > > }; > > > > static struct pmu_events_map map = { > > @@ -162,9 +176,28 @@ static int test_frontend(void) > > return 0; > > } > > > > +static int test_cache_miss_cycles(void) > > +{ > > + double ratio; > > + struct value vals[] = { > > + { .event = "l1d-loads-misses", .val = 300 }, > > + { .event = "l1i-loads-misses", .val = 200 }, > > + { .event = "inst_retired.any", .val = 400 }, > > + { 0 }, > > + }; > > + > > + TEST_ASSERT_VAL("failed to compute metric", > > + compute_metric("cache_miss_cycles", vals, &ratio) == 0); > > + > > + TEST_ASSERT_VAL("cache_miss_cycles failed, wrong ratio", > > + ratio == 1.25); > > + return 0; > > +} > > + > > int test__parse_metric(struct test *test __maybe_unused, int subtest __maybe_unused) > > { > > TEST_ASSERT_VAL("IPC failed", test_ipc() == 0); > > TEST_ASSERT_VAL("frontend failed", test_frontend() == 0); > > + TEST_ASSERT_VAL("cache_miss_cycles failed", test_cache_miss_cycles() == 0); > > return 0; > > } > > -- > > 2.25.4 > > >