Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27316079rwd; Tue, 4 Jul 2023 00:57:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlEt00ioPsLiZ9ljs8SZhcgKF5UvC4CFHWQVskO7kNxqf8Ma8zbpruGFYmR1q6NMuAOEi/Nf X-Received: by 2002:a05:6359:59d:b0:133:ac7:c847 with SMTP id ee29-20020a056359059d00b001330ac7c847mr7848207rwb.20.1688457433166; Tue, 04 Jul 2023 00:57:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688457433; cv=none; d=google.com; s=arc-20160816; b=dZlcW1dbG5+YyfV5AAxucYa4IOnk2gesGSmcBZkDXnLFTYTQBk8vk4v/0LQ31Kk9hl zE+W2lR/JQhbkMbNO+M+WEhAzG74oIaORAj6qn0MhklQGiVSAOtKndMMsExesbabfScg d6VEfBOl0iOkOh3Gk/Z+/2F0lb398V3heOvst69cto8Yo05wv1yn93hxGn6HJQnitBdh nhXz8RrThCeHdjD1QeBXtRN1CTcjL4Ug4RxvhMaSVNL5Ew7Zid1zXt3Jb5gOQKneCmKw kGs4+Xbaq9BoTt8bQrE9t1XB0Z04g8AgKbsC7JU/UPWQVvOpOKiJas9aekVSTQo0IQjn pM2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=EO9VNYMWXIQfwZNdyIb7KPJ7pVNEk665BTSuTYq5SYI=; fh=td1tWwqmzXUMurl83U4wnxYbX8ZMZukrMraSvbRxzQ0=; b=mx02q3aHOfgMA7tBCp5DGuajIofKbmKBwwZcJ2g3fOXG0DsQvqSM+BFZiKXbgYk+ES Kr1d5R7ObDZ1wj9M3o8RAgZdiVm3dft7H/zr9OYPtwuhh7gGoXClC8hMjKl9r29tzje0 vlBlnTq9jAW1rs/JiT/8i+ZxiuS3iF3KKc4c+A40EgF1k9paTMtBJffYceJZT1e989CS 1CWHWZhk4hjBbqfP717hlDi1E9LHRL/amcsRFu8r4XiK0NWys2qKnxRcwl/EAqngfJL4 G8Zp5Xhy3oJ/FnYvOt08zf9DS/AHKarPoLaUofK4IDvz9YCEFtz7bbexD0sQVp/YT706 NQfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s15-20020a63dc0f000000b005573ca1a657si19875358pgg.118.2023.07.04.00.56.58; Tue, 04 Jul 2023 00:57:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230032AbjGDHon (ORCPT + 99 others); Tue, 4 Jul 2023 03:44:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231450AbjGDHoa (ORCPT ); Tue, 4 Jul 2023 03:44:30 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26FFFE7A; Tue, 4 Jul 2023 00:44:24 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QwF9t4yctzLnh6; Tue, 4 Jul 2023 15:42:10 +0800 (CST) Received: from localhost.localdomain (10.67.174.95) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 4 Jul 2023 15:44:21 +0800 From: Yang Jihong To: , , , , , , , , , , , CC: Subject: [PATCH 4/5] perf test: Add test case for record tracking Date: Tue, 4 Jul 2023 07:42:16 +0000 Message-ID: <20230704074217.240939-5-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230704074217.240939-1-yangjihong1@huawei.com> References: <20230704074217.240939-1-yangjihong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.95] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new test case to record tracking side-band events for all CPUs when tracing selected CPUs Test result: # ./perf test list 2>&1 | grep 'perf record tracking tests' 95: perf record tracking tests f# ./perf test 95 95: perf record tracking tests : Ok Signed-off-by: Yang Jihong --- tools/perf/tests/shell/record_tracking.sh | 44 +++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 tools/perf/tests/shell/record_tracking.sh diff --git a/tools/perf/tests/shell/record_tracking.sh b/tools/perf/tests/shell/record_tracking.sh new file mode 100755 index 000000000000..fe05f4772999 --- /dev/null +++ b/tools/perf/tests/shell/record_tracking.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# perf record tracking tests +# SPDX-License-Identifier: GPL-2.0 + +set -e + +err=0 +perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) + +can_cpu_wide() +{ + if ! perf record -o ${perfdata} -BN --no-bpf-event -e dummy:u -C $1 true 2>&1 >/dev/null + then + echo "record tracking test [Skipped cannot record cpu$1]" + err=2 + fi + + rm -f ${perfdata} + return $err +} + +test_system_wide_tracking() +{ + # Need CPU 0 and CPU 1 + can_cpu_wide 0 || return 0 + can_cpu_wide 1 || return 0 + + # Record on CPU 0 a task running on CPU 1 + perf record -BN --no-bpf-event -o ${perfdata} -e dummy:u -C 0 -- taskset --cpu-list 1 true + + # Should get MMAP events from CPU 1 + mmap_cnt=`perf script -i ${perfdata} --show-mmap-events -C 1 2>/dev/null | grep MMAP | wc -l` + + rm -f ${perfdata} + + if [ ${mmap_cnt} -gt 0 ] ; then + return 0 + fi + + echo "Failed to record MMAP events on CPU 1 when tracing CPU 0" + return 1 +} + +test_system_wide_tracking -- 2.30.GIT