Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp11493ybg; Tue, 2 Jun 2020 14:52:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFcaEi/00VKSr7p5oKzztrI+hSpeVcoKe1PRpP4v48SGliLtau4Olq/aOvibJOqPgIrUP7 X-Received: by 2002:a17:906:2b8f:: with SMTP id m15mr16749876ejg.156.1591134746354; Tue, 02 Jun 2020 14:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591134746; cv=none; d=google.com; s=arc-20160816; b=OXsYf02Qko+nwCUdCJZwhb7ejCMgdQJfu0rbf30W9Q5rj1nV4+KA5vFQK8R5sl61hj 5nr26bQpDgvJ5UvNXro5ZyUHPRysiRjXPlwkU4weAwzAzqSCXDQg9qR1V+oXjx6NCgHJ dlL0iTEaru2jeJ3MVfOt8W3YzcPr/cx2N1jX5xAtHZClHvJclFo/s/Wtc/ManS7gZezR QN8iIIzDp6OBX8pSk2tZrSRA8/rKnze1xzcLJNtIlkHsZeDEvriwoc/g3BvlnEiB6Jes KRyQU1zGJhOeirVeYkdIFTrRkIOMTz7K31BSwjwNgiKuzWRZxerS7LxIl+XgSlWmJgfA LwrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=khpt44rk/8yYMY+X/uVsoGziqGK9z1UNHS63gh5Og1k=; b=d0ThwD3xA5fQC2KXhgSDcu96HrxGGj3DnnbPfNKV2CObu3zv/vp5gz1Un0zElvkQ1A svGDC+8TPW904JveurFUqPdbMgkpcmiqskAK34PD8P7YQzDP5mYHg+XsUQagedwxHCOb Tv9M4y1m2a1br0Ylw9yWaiIN92hj17hDe0CbujsTe7bsYJ43lyeApSgFdSpIHPCBpVU0 q9g59EDyLGmRMyXeoY21M7iGLpyg89fmtmBBHBs2TjYmhYRSp+2/a9VP/sQO+5f7ANbN yUGPYXVm0kWZVHxLWcnZ0hyle7AKcX4BUvBu0vAXMWF4m3IBu3kFuwok8eIUrwnNLHRc nUAA== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x26si2225585edv.448.2020.06.02.14.52.03; Tue, 02 Jun 2020 14:52:26 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728558AbgFBVss convert rfc822-to-8bit (ORCPT + 99 others); Tue, 2 Jun 2020 17:48:48 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:57954 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728537AbgFBVso (ORCPT ); Tue, 2 Jun 2020 17:48:44 -0400 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-485-1SgRJBCeM3mLfWNksCcgrQ-1; Tue, 02 Jun 2020 17:48:38 -0400 X-MC-Unique: 1SgRJBCeM3mLfWNksCcgrQ-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 46AA9801504; Tue, 2 Jun 2020 21:48:36 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.192.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id A069C1BCBE; Tue, 2 Jun 2020 21:48:31 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Ian Rogers , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Stephane Eranian , Andi Kleen Subject: [PATCH 13/13] perf tests: Add parse metric test for frontend metric Date: Tue, 2 Jun 2020 23:47:41 +0200 Message-Id: <20200602214741.1218986-14-jolsa@kernel.org> In-Reply-To: <20200602214741.1218986-1-jolsa@kernel.org> References: <20200602214741.1218986-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding new metric test for frontend metric. It's stolen from x86 pmu events. Acked-by: Ian Rogers Signed-off-by: Jiri Olsa --- tools/perf/tests/parse-metric.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tools/perf/tests/parse-metric.c b/tools/perf/tests/parse-metric.c index 717a73fa7446..1939e567a8b3 100644 --- a/tools/perf/tests/parse-metric.c +++ b/tools/perf/tests/parse-metric.c @@ -17,6 +17,11 @@ static struct pmu_event pme_test[] = { .metric_expr = "inst_retired.any / cpu_clk_unhalted.thread", .metric_name = "IPC", }, +{ + .metric_expr = "idq_uops_not_delivered.core / (4 * (( ( cpu_clk_unhalted.thread / 2 ) * " + "( 1 + cpu_clk_unhalted.one_thread_active / cpu_clk_unhalted.ref_xclk ) )))", + .metric_name = "Frontend_Bound_SMT", +}, }; static struct pmu_events_map map = { @@ -138,8 +143,28 @@ static int test_ipc(void) return 0; } +static int test_frontend(void) +{ + double ratio; + struct value vals[] = { + { .event = "idq_uops_not_delivered.core", .val = 300 }, + { .event = "cpu_clk_unhalted.thread", .val = 200 }, + { .event = "cpu_clk_unhalted.one_thread_active", .val = 400 }, + { .event = "cpu_clk_unhalted.ref_xclk", .val = 600 }, + { 0 }, + }; + + TEST_ASSERT_VAL("failed to compute metric", + compute_metric("Frontend_Bound_SMT", vals, &ratio) == 0); + + TEST_ASSERT_VAL("Frontend_Bound_SMT failed, wrong ratio", + ratio == 0.45); + 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); return 0; } -- 2.25.4