From patchwork Wed Nov 9 17:46:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 17717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp474857wru; Wed, 9 Nov 2022 09:50:25 -0800 (PST) X-Google-Smtp-Source: AMsMyM5gB7M6dfke2t5bREUlEbe/mCMJugQ4LrPaE+C49345RwRfYoe5cGCTxAOmGMEr4sNDv9Ay X-Received: by 2002:a17:906:4b50:b0:7ae:ea4:583c with SMTP id j16-20020a1709064b5000b007ae0ea4583cmr1301864ejv.587.1668016225532; Wed, 09 Nov 2022 09:50:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668016225; cv=none; d=google.com; s=arc-20160816; b=ImGoJ3v2zpjv/pGmACQx9nc1VoGR3zSJyNFe3M8QTBX5T09iFuWK2opjqpZjNh8yqz cQpmP/UdVL96iwcX+om6fHPM7i9JIDFqJ7cSaf6kBmfvy9j/3qTiyPGB+0dAUKFLEbCT 4KS2VMkk50xRTpvkcOnicsEEsM7Hmhux2uTGG66cGcDLi2ze2IkKb8QX/baAXK/0fbxM n+6jojMR4b0TDPXNjykf1Vk0iw8WvjzhgroazLjT5i/UysU4AxSNU7+w/Oxo1sURWgNj l87R/pMWvhhouaXmjI9oSqz0td9ZyryEd55KE60S5Bk+v0IWyM7/uSR739d5STqBIOkX oU/Q== 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:sender :dkim-signature; bh=xt+WoBEPSCbce4SU7k7Lvd7WOnbPXIYlVffaFzdNGBU=; b=mSHZthqA0JxJ8OpLQg9tnaUcmUfixagdT8r6boJ0lvnd9Tuom4dPmBMHQWQmCVHrcq JQM6g0ZNlAf1UnGzO8wR37gtPGFve328e32FvtJeYKkmGM93Oa56jKCl45YMzoC3oEDI p4fTTCy0dC+nETUdtGQ4DbxcrlYwgjmzLuq0vz5WjS67DetU3pm7HBy51rNhCf/hLKIl JLvGxa0ed02hHnuDq5Tvpm+vSvKXgZLlcrrKO5rG5++JZdd71xU9cWcU2HbsnuzGtf9s TVSpE90pxJCIcqWzEgqjWwaDDeD7wzI+udM0OFDY202GZHywymlTxhYam07BCXBScKsA zCDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jNWDt47U; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f18-20020a50fc92000000b004637e92aa81si14051740edq.355.2022.11.09.09.50.01; Wed, 09 Nov 2022 09:50:25 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jNWDt47U; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231799AbiKIRqs (ORCPT + 99 others); Wed, 9 Nov 2022 12:46:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231750AbiKIRql (ORCPT ); Wed, 9 Nov 2022 12:46:41 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8FCBE70; Wed, 9 Nov 2022 09:46:40 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id b1-20020a17090a7ac100b00213fde52d49so2607445pjl.3; Wed, 09 Nov 2022 09:46:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=xt+WoBEPSCbce4SU7k7Lvd7WOnbPXIYlVffaFzdNGBU=; b=jNWDt47UqufTjvRMGEX6BH/6RYZ0QfrGI7q6r3LGHQStZ91PZT32H/Lsxk1b8qtMgp BfWKREETEGMNcMX+FTrnJM8SDogq+UD9OZhVqM/BhQ90+xShOz6T7NSOx3N2+AjHuoha SwKCtSz5e6I7nsn/MJxadNzMMRYJ5YO0jCW/Lu2l0H4NU9fXLtFgBmPAg+yfhjI7KV5x W7bQNx51aInbL6PBDFc+FZQvhQzX1ZNsC8Kqtai4W4WOWnmni53sSzBPJHbeaLwSaqqN Iher7PbaBIgHn3DYXybYjlwh8qGv6kkKrzST9P9uJsCgbcqY5J6n01lXq0gGk06rNnsJ YkTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xt+WoBEPSCbce4SU7k7Lvd7WOnbPXIYlVffaFzdNGBU=; b=Wfbk+Sg9FPuD0IaqAOu8PP2vZXZRRmVseS7a2GlzHSyrNtEg3yKX33utWBZqRtZJrM jbxHbgXeaFYihYeF0r6blQMQsbdwDZg8HKaOTvZ7pC5xJBh9iY4Z94bk9qI2SsDEYrL+ yuV4NLFov5oB/yETtm6dqxIx56Telo14SzN9DQIa/Oal3hJz2cETEdvZbz0Qp3bif1qq HOYY5bMa/Hz92ZC9Zh8RGLFDfpMbPypHgvasIEl8LBX/V9Har6CivrvfgC2DpoO+MwcX QeGfDE2QHBMk7L+Vw/dl0S8x+H/h6kukvdMgGtmeDaoHHKEL/YlDUN7FUnvvF6Whytyd UmXw== X-Gm-Message-State: ACrzQf07IFn4xIcdjdTIppz6rC8Khq+m6FmXxXBKoel1D4OtE11dmAQw pokNNbA1HdgO/ZJp1ZSdWvQ= X-Received: by 2002:a17:90a:4dce:b0:213:9d22:8870 with SMTP id r14-20020a17090a4dce00b002139d228870mr65397473pjl.7.1668016000181; Wed, 09 Nov 2022 09:46:40 -0800 (PST) Received: from balhae.corp.google.com ([2620:15c:2c1:200:fa05:f3cd:da75:3103]) by smtp.gmail.com with ESMTPSA id a10-20020a63cd4a000000b0043941566481sm7877909pgj.39.2022.11.09.09.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 09:46:39 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Leo Yan , German Gomez , Zhengjun Xing , James Clark Subject: [PATCH 02/12] perf test: Replace pipe test workload with noploop Date: Wed, 9 Nov 2022 09:46:25 -0800 Message-Id: <20221109174635.859406-3-namhyung@kernel.org> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221109174635.859406-1-namhyung@kernel.org> References: <20221109174635.859406-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749041781797544709?= X-GMAIL-MSGID: =?utf-8?q?1749041781797544709?= So that it can get rid of requirement of a compiler. Also define and use more local symbols to ease future changes. $ sudo ./perf test -v pipe 87: perf pipe recording and injection test : --- start --- test child forked, pid 748003 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.000 MB - ] 748014 748014 -1 |perf [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.000 MB - ] 99.83% perf perf [.] noploop [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.000 MB - ] 99.85% perf perf [.] noploop [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.160 MB /tmp/perf.data.2XYPdw (4007 samples) ] 99.83% perf perf [.] noploop test child finished with 0 ---- end ---- perf pipe recording and injection test: Ok Signed-off-by: Namhyung Kim --- tools/perf/tests/shell/pipe_test.sh | 55 ++++++----------------------- 1 file changed, 10 insertions(+), 45 deletions(-) diff --git a/tools/perf/tests/shell/pipe_test.sh b/tools/perf/tests/shell/pipe_test.sh index 1b32b4f28391..8dd115dd35a7 100755 --- a/tools/perf/tests/shell/pipe_test.sh +++ b/tools/perf/tests/shell/pipe_test.sh @@ -2,68 +2,33 @@ # perf pipe recording and injection test # SPDX-License-Identifier: GPL-2.0 -# skip if there's no compiler -if ! [ -x "$(command -v cc)" ]; then - echo "failed: no compiler, install gcc" - exit 2 -fi - -file=$(mktemp /tmp/test.file.XXXXXX) data=$(mktemp /tmp/perf.data.XXXXXX) +prog="perf test -w noploop" +task="perf" +sym="noploop" -cat < -#include -#include - -volatile int done; - -void sigalrm(int sig) { - done = 1; -} - -__attribute__((noinline)) void noploop(void) { - while (!done) - continue; -} - -int main(int argc, char *argv[]) { - int sec = 1; - - if (argc > 1) - sec = atoi(argv[1]); - - signal(SIGALRM, sigalrm); - alarm(sec); - - noploop(); - return 0; -} -EOF - - -if ! perf record -e task-clock:u -o - ${file} | perf report -i - --task | grep test.file; then +if ! perf record -e task-clock:u -o - ${prog} | perf report -i - --task | grep ${task}; then echo "cannot find the test file in the perf report" exit 1 fi -if ! perf record -e task-clock:u -o - ${file} | perf inject -b | perf report -i - | grep noploop; then +if ! perf record -e task-clock:u -o - ${prog} | perf inject -b | perf report -i - | grep ${sym}; then echo "cannot find noploop function in pipe #1" exit 1 fi -perf record -e task-clock:u -o - ${file} | perf inject -b -o ${data} -if ! perf report -i ${data} | grep noploop; then +perf record -e task-clock:u -o - ${prog} | perf inject -b -o ${data} +if ! perf report -i ${data} | grep ${sym}; then echo "cannot find noploop function in pipe #2" exit 1 fi -perf record -e task-clock:u -o ${data} ${file} -if ! perf inject -b -i ${data} | perf report -i - | grep noploop; then +perf record -e task-clock:u -o ${data} ${prog} +if ! perf inject -b -i ${data} | perf report -i - | grep ${sym}; then echo "cannot find noploop function in pipe #3" exit 1 fi -rm -f ${file} ${data} ${data}.old +rm -f ${data} ${data}.old exit 0