From patchwork Wed Aug 28 14:07:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13781349 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 30DC4C5B548 for ; Wed, 28 Aug 2024 14:15:01 +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=Il04epHFd9BrsJtGAU8mELFSezcE7nnWBSPUsdUkN8I=; b=rJtBiy1f4I8tiS5v2OKEKNb+FY RP0g3u1P4XQsuPPvuumvVB7Ch29lfiYMX4JcbCfk4RQgwLzJSxIaMxUPCJrFE30fEowOXR6zLWX+e JLRgGpW+CZMChBsEdfZE8WPSzYtiUhMTfH3sX4zvQOvHGR2/TxuUo99WdbByt7JjmiuLWluiL6tGL QAc4F4UEx+pmFG/GKhRVvWpynwg6A7zQCzqqwGA4EohwNtFhynG5LIow4UMtoYoW7B6W7LhiMB7xx k9xE4dbnnxSNsh57ybo/Ri9Lzg+kUF5qy50XnFrWFgO16qqW+0YbzyQCOFk/d4EP4EJ2jLogXwpw2 xfMTRKhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjJRh-0000000FhXc-29uA; Wed, 28 Aug 2024 14:14:49 +0000 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjJMv-0000000FgBv-23qs for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 14:09:54 +0000 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-5bed05c0a2fso8159253a12.3 for ; Wed, 28 Aug 2024 07:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724854191; x=1725458991; 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=Il04epHFd9BrsJtGAU8mELFSezcE7nnWBSPUsdUkN8I=; b=tgL5QhW4mneO1H0E9h0qd15WqJu0TJd2KJfj01ricgBGCmQrdj0/ou5gcN3YXIg9Ow IgzQkmCEgohpRJ4jlOPCjvlBfQNEURLv6L451+epSlxU4XUAFq2Q01HQ0Fnixiq0JeBG ptNkzFb5965VGw/gRy0+nGcFkJyp8GdRpmTvqPiD7w1iwX4u008SaanaODcorV3ld73a i5gZm594ZaUq+cSqsngzByGy9TIrcDcWZ+C0XdjRfkA3tKkFF2hogzOu72ByGE2eSJB1 q1m42cTPQEAAF6VZmkzfTgb4Y6qyk4AyuV/UCXZrYmyWL5QH+uub0Mf/xVhvX7NX93hn 4J3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724854191; x=1725458991; 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=Il04epHFd9BrsJtGAU8mELFSezcE7nnWBSPUsdUkN8I=; b=iMNfemOljFNLPhQfdYvRxX7reQ6c9o0T731Grf4kcKmHyeKf52/BTSvXZJZ2vM+rz5 OofjyUFFpx8thf7XhPuUFxpWTXITD9NJVwlDD/+GD2fgPooSUg2Pkdx4FQ5QMqXlOa5q 6Y/4ndtcvJsZeYpD5inKkZgGR6WJ6ualt7tBZM4gu/mWUdwKflTm65lG+tIrPNQNwp5n F/6y/D2o6bZGfkZ2zhQWYEti4x1QXggkHK5G9F7OHy/3UyH+CVuizds56hegwQLSOjrJ l5xiu+3RKIvY66YK9sjfnd+YpQB7Y+PJP0NUoK0X30lpUbJPXAZO8Ezs2LiKOWSOYamC kAtw== X-Forwarded-Encrypted: i=1; AJvYcCVgrUS3OkqUTG7Yiz1hczgMAxB1BO5CzjHCKdWmCRHheCQBufxwa4t55b9nMhxmgkyO7fqbWteRY9n+MzoBHxID@lists.infradead.org X-Gm-Message-State: AOJu0YyGytZZtxBzjt2ftdZT4wt4b+ld7V+qnjOUMbXK7cfQ/W3bjWaK kCyQt8w3EsbOGcHiwoU/dPtOQEYqqhrzkDOhaZCYE1SZ7rfP9y7MwsFfamlhnaQ= X-Google-Smtp-Source: AGHT+IGfU9r8eCZ1F54SsYtSTEbWp48pODz+BAIgPEFvEm7Ao+dfQxCs2umNAwFacPms+yzwmqUedg== X-Received: by 2002:a17:907:e6a3:b0:a7a:ab8a:38f with SMTP id a640c23a62f3a-a86a52c37c9mr1305055766b.41.1724854190212; Wed, 28 Aug 2024 07:09:50 -0700 (PDT) Received: from localhost.localdomain ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a86e5832855sm251302666b.130.2024.08.28.07.09.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 07:09:49 -0700 (PDT) From: James Clark To: irogers@google.com, linux-perf-users@vger.kernel.org, kan.liang@linux.intel.com, ak@linux.intel.com 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 , Weilin Wang , Dominique Martinet , Athira Rajeev , Colin Ian King , Yang Jihong , Ze Gao , Sun Haiyong , Jing Zhang , Yicong Yang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 7/7] perf test: Add a test for default perf stat command Date: Wed, 28 Aug 2024 15:07:21 +0100 Message-Id: <20240828140736.156703-8-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828140736.156703-1-james.clark@linaro.org> References: <20240828140736.156703-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-20240828_070953_541195_EDBF1DBC X-CRM114-Status: GOOD ( 13.91 ) 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. The event line can either be output as "pmu/cycles/" or just "cycles" if there is only one PMU. Include 2 spaces for padding in the one PMU case to avoid matching when the word cycles is included in metric descriptions. 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..24ace1de71cc 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 -E "/cycles/| 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