From patchwork Tue Aug 13 13:23:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13762054 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E592C52D7C for ; Tue, 13 Aug 2024 13:30:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Vqh5EYvMFCPE5arJzUrVuYN8olqKoGJkP7ilX3wyAGI=; b=bFUGqWkVvGrZG/Z+3gBdtfe7js duIvofS/HWY/piH2mVFGcSo4+B+HaBirQb98Bft66PfYCPqlx4bIBkKRj6iFtDy6HIGazWfvYwlxt FIU0w2FLwGz6bP8eBgFA/j1GE4FPJEgFOyqZsJGSXsckCEiIe4a2Fenp7ToCBeuDPHnGYPn52uGtc s6rtCFdj4LihdXLJcgWY7OTOCvZYzhPfclnJEtaP6OVW7sPN3qV4kXA3A5Bci5NGnTfD128Cn2RKX 4ZYsyX+7HheN4B9aMCs3YfBqzHA5kis18pFC/oNwrkWUzwVXf/la+guxAXRvvFfqGFvEht6iBmoDe ArKKkahA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdrbD-00000003shk-045I; Tue, 13 Aug 2024 13:30:07 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdrX2-00000003rS4-26rs for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 13:25:49 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5314c6dbaa5so4846783e87.2 for ; Tue, 13 Aug 2024 06:25:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723555546; x=1724160346; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Vqh5EYvMFCPE5arJzUrVuYN8olqKoGJkP7ilX3wyAGI=; b=gYwHaKSnYE+otctin+90ML+Xm5HFLVFGKYrOshfMLRTE/uOM2GUjosAfH8tVjLEaX6 7lcrMVdj7NDqPyYVqJHMeRInbvm1TlV9nXbCDbNHi0Bh403xRgjgOTchf0Ey+GRF757k l56PQ2W+oI76ZIzWo2TD5vrGzN/4f3qhK0XOmf6GEMBBAMvjPJiibbewz2uFFiwQm8JS MRFVVGimKxEzjdvP83ZSjMKTkMa0fPLu/YE4NzjYgt8A918awZwloZrk9jZjJeNVSSli Oi+ExVG/LFctoxpReJN45aUoVpZg30YOPldxaOtx8wU4ZEF9iPoaIiEkIvjK4GjB5SAv 2VBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723555546; x=1724160346; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vqh5EYvMFCPE5arJzUrVuYN8olqKoGJkP7ilX3wyAGI=; b=u+blBwftzE4P0yjKviM1rVvxa0C4m74Re7dvXdq0/iU6dFtLrDlqk9kWWQPqeowmLI mgWnU/LJQCL8Vxnr6FK4hlTfRLIJJsGbQ8J5qSrl7JQ3TcEKzejKbWfQeDAyhUWa6kwK VGhIBI6iqB4yf9i4T/wBgrLZYsRawh4WHVegJT4P/YeFv07vgQWMCt99E4AzC/AwOHDw jXXEc5/GAm6RhRtLU0X0nbBBC8ydM2LTD4Ghq/hZ5PkLf7OeP9/835vMZOs0VaWUKME2 EP7hHuymKHQ4wQyt4LnsMDMNKz+7lioWFjlpkBYCPbijOq8/a4W8VPIlv1CR9eDce/FR 4C+w== X-Forwarded-Encrypted: i=1; AJvYcCUXRXOEtOmjhq9JurLTlJK73Yo6EHew+SEmzoLIBEEsYvMAg+R75QiSSM9j1RQI/H8eB75KN3ZClrBLAAU2z/8f2dqQmpaTd98nfi0xMJo3VCUEqgc= X-Gm-Message-State: AOJu0YzutwNVbq7Xp935/XCcgWJeWXEurPUwEHkWbHijCOPEmjuLW7Pq tPZrnfCZrD5nu0KKtS5tk4043wwjOL4o2yhKewh5H9J04Xak9c44p25078DBOvY= X-Google-Smtp-Source: AGHT+IHMLVGDigrqektOOEcKtHUBUrZ0H1yBfl4W0aPOysz0l5q5wIN+XwIpSkq9sMLm2xPQfj7tKA== X-Received: by 2002:a05:6512:2348:b0:52c:e0e1:9ae3 with SMTP id 2adb3069b0e04-53213694527mr2503106e87.57.1723555546132; Tue, 13 Aug 2024 06:25:46 -0700 (PDT) Received: from localhost.localdomain ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4290c738d21sm223186625e9.12.2024.08.13.06.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 06:25:45 -0700 (PDT) From: James Clark To: irogers@google.com, linux-perf-users@vger.kernel.org Cc: James Clark , John Garry , Will Deacon , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , Yang Jihong , Dominique Martinet , Ze Gao , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 7/7] perf test: Add a test for default perf stat command Date: Tue, 13 Aug 2024 14:23:15 +0100 Message-Id: <20240813132323.98728-8-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240813132323.98728-1-james.clark@linaro.org> References: <20240813132323.98728-1-james.clark@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240813_062548_630549_587BD724 X-CRM114-Status: GOOD ( 13.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Test that one cycles event is opened for each core PMU when "perf stat" is run without arguments. Signed-off-by: James Clark --- tools/perf/tests/shell/stat.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/perf/tests/shell/stat.sh b/tools/perf/tests/shell/stat.sh index 525d0c44fdc6..7118cfc37f48 100755 --- a/tools/perf/tests/shell/stat.sh +++ b/tools/perf/tests/shell/stat.sh @@ -148,6 +148,26 @@ test_cputype() { echo "cputype test [Success]" } +test_hybrid() { + # Test the default stat command on hybrid devices opens one cycles event for + # each CPU type. + echo "hybrid test" + + # Count the number of core PMUs + pmus=$(ls /sys/bus/event_source/devices/*/cpus 2>/dev/null | wc -l) + + # Run default Perf stat + cycles_events=$(perf stat -- true 2>&1 | grep "cycles" | wc -l) + + if [ "$pmus" -ne "$cycles_events" ] + then + echo "hybrid test [Found $pmus PMUs but $cycles_events cycles events. Failed]" + err=1 + return + fi + echo "hybrid test [Success]" +} + test_default_stat test_stat_record_report test_stat_record_script @@ -155,4 +175,5 @@ test_stat_repeat_weak_groups test_topdown_groups test_topdown_weak_groups test_cputype +test_hybrid exit $err