Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1232573ybg; Tue, 2 Jun 2020 04:54:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhcWnIEOkIzbbm2Prh6tEMR4jJbJThLtpbe+aoj9Q7C8FgPn/P+FvKy9Ncdx7i0/We/yFx X-Received: by 2002:a17:906:d043:: with SMTP id bo3mr22459807ejb.409.1591098899587; Tue, 02 Jun 2020 04:54:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591098899; cv=none; d=google.com; s=arc-20160816; b=DGB8Rgzb3YHxlc1uIKnsccUh8ldPxiWAkJffAsOjuJTruNq0xzCijgWPGjxXS6lfXD 7ezAIGOtTPoGbu4ptdK/JPuIcpqVxUMFoNstR823JXLLYxHE8qX3h3UqFezTlEtu2/bX i8K/9G3+49H6qj4XxC923r/Y9dmoUTQLzvop8WKPBgoCG/9aTqGluOUQa5IgBXAmzw4N oHVf/sJLVk7eEEutmrpJweRtk1sTQ5QM1e6ySS6FyVWVIl8yjT2ch2z8Q7Ng831vnt/z yqO+x8x3man6/mvsIGdlxHWRv6RgM0e6qMVXo1V8bk2lmH9oWqpzNTDD9IAw5F4ebfZ7 cpVw== 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=YdOdG8qPbPm2U/lnvwWapyOqMpd1BpiOvuT01EO6wNk=; b=wa06dSy3MW11uj8+er390GfIPWRMzmzrxqJfmAKVln+rNIYCHpLgZ5VMbpSWCEZNUQ c0G6KnuicE3uwqwNwMJc7aKGLjBOHB91s/RaVy9yH0KpmbUaCSyJSE7yBQcKFuKWQ++F qvFnvdMIQKDAlTcnoiQoBC9+FmtcGIr2oibstFDoBGuPqYGzTw+Wa8bKzdxFuMyr2qaS fvyRS62U2YPzcAkk5dvia0TdAZQ1T+ZqyQk0XmxdNpvZ+4FE+FMzs2vXBBvHZC7LzdTd oUhOrnIXluAjCMbnEqVQXdB8Tg6oEn4NyAYqkb9egwFOnFx7bWo4nYPIrqZzndVicEbb JgJQ== 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 e18si1359125eds.250.2020.06.02.04.54.36; Tue, 02 Jun 2020 04:54:59 -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 S1728294AbgFBLvm convert rfc822-to-8bit (ORCPT + 99 others); Tue, 2 Jun 2020 07:51:42 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:52343 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728273AbgFBLvl (ORCPT ); Tue, 2 Jun 2020 07:51:41 -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-219-NNEkWOMfM42oLFXHcpnO8A-1; Tue, 02 Jun 2020 07:51:35 -0400 X-MC-Unique: NNEkWOMfM42oLFXHcpnO8A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BDCD61800D42; Tue, 2 Jun 2020 11:51:33 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 790DF10013D7; Tue, 2 Jun 2020 11:51:31 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Ian Rogers , Stephane Eranian , Andi Kleen Subject: [PATCH 13/13] perf tests: Add parse metric test for frontend metric Date: Tue, 2 Jun 2020 13:50:55 +0200 Message-Id: <20200602115055.1168446-14-jolsa@kernel.org> In-Reply-To: <20200602115055.1168446-1-jolsa@kernel.org> References: <20200602115055.1168446-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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 metri test for frontend metric. It's stolen from x86 pmu events. 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