From patchwork Wed Nov 9 17:46:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 17719 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp474874wru; Wed, 9 Nov 2022 09:50:28 -0800 (PST) X-Google-Smtp-Source: AMsMyM5agreGMznnBnflgh5TgPv3JY4U0nuHXO5tO9zwJjzMDeO+OBFPyG5IJ5SKIutb+UFkrzX7 X-Received: by 2002:a17:906:40d2:b0:79e:8360:8c3d with SMTP id a18-20020a17090640d200b0079e83608c3dmr1543615ejk.146.1668016227963; Wed, 09 Nov 2022 09:50:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668016227; cv=none; d=google.com; s=arc-20160816; b=zTzzA+V3hzch8pkXcpFsPIqf0OIZehRqBEjwgW+iDiSBwJtikyjheo3t9qVUy4w6AF hjU/GThA+kPK4thDpO7GbyNsgzVdh91KcPU+KDnic7uH2HMSyMVY1Lm+CFay0ss4DR8F h5oCuOfGGrNPLdxK0uF+0Dho7HJJotg0v8c179rGhtKMslzMzf9uAKZWTUknMOrZMUPh fr5R42zrdF1VqYawMF7LaePY8woiiJ84I12KFLPD81fhyYKlX00ss87VFAt5/g9brgt5 O72MUbzR0xq0YA8MOagQ5p9pFBZbfByB+RQPwngmL/YlwaKNAAmtlES47sE3VjMq1itz Ippg== 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=audwF3R26hO5/1tDhu1hZ0cjBE15kB3JCoKo0JD+sBo=; b=zJMBafeQjOEoPxY351xN1pefmZtyEc0CC2XKe41UPeNGxFewioEL5tHpnOe4sgPHtz +aAga6V71czQrakEz2jayVk6PKWPF2qqNMHfrNPBzwCp2l+5MaYyGIN4QaSaukRVJjTx lZQuEQtGxJqB3Uy8bEi/HFKbPyH1cnS39E5GkZtbLYGo6OwKFAnrooZZVtbM+ypBUZt6 Wk2g7E3fcAZgkyO3BVsshV+j60Hm6ElQLFBVYZ1YJqfIXUNQyVL9/H2E5lJQT+FeMWjg C81N8ZKUgdKcNuTemsK9dcOTQQi2i87FPZcQ1Qyvphl1G13uHEULgIx+1RInvtXuhTug 0NPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pxrvctkl; 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 j8-20020aa7c0c8000000b00461e685ce72si3331502edp.116.2022.11.09.09.50.03; Wed, 09 Nov 2022 09:50:27 -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=pxrvctkl; 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 S231816AbiKIRqz (ORCPT + 99 others); Wed, 9 Nov 2022 12:46:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230413AbiKIRqn (ORCPT ); Wed, 9 Nov 2022 12:46:43 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 411B164F9; Wed, 9 Nov 2022 09:46:43 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id g62so17367912pfb.10; Wed, 09 Nov 2022 09:46:43 -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=audwF3R26hO5/1tDhu1hZ0cjBE15kB3JCoKo0JD+sBo=; b=pxrvctklMWfU4Gw5H7393MIwP0VxLN6JqplrrIb1uGKQrtemctjAlR3Xxor574z33L ybcyJGD/lI7c9Tx0zKswNiJm9pONqSSd4Luiw85JsK9CRQho004/05D+baCwCmOMNjDd ihMYeWMgXYo83+dv3f/CIJvBkpF+rLF0+s8xiBhlmpi9BJVnBywf+0r43LBbvBmqQ1i7 nDgXXM9SVo4KxeV/aZI/mWdy+jTyaLSTpTjjSg0KrsGzGeqpPWGhJVa1gcJ5ayCZ5Be/ M2o83nn07RSAm6oWSNu79EAjS7/RzUXQFzP2zfaPLN9s43x6l6FPZPlRnqACmYgvMmmX zMqw== 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=audwF3R26hO5/1tDhu1hZ0cjBE15kB3JCoKo0JD+sBo=; b=kmuylX+vLahydrhn9lmq5IlySG7BlbcWcGKYoe0OQmnxLog5bxD/CclrDyvElM5Fh7 dgQm2YXN8urjTuEa4S7iwUj8eQ12HGAreLLjN6RX5zySUYfwVSZyg39Kn/2ZhAlWRf5z vahkSEl4gI9DhYaLyDWzFTUCaCLjQm3sgXJZoNR69fD6+gVqBkEzh+Ed7jTpHln0M1+t Ze7TbeJfeT5uKNyDsMlCa95AxerKUdRsk8B1tH22qm44lB1JfJ08uNNT0TEfGdBzbifs jtnLkOK82vraYcn1GSllJgj8P42CdccI/AwBDanXCtLDTD1vVzxC9aOOOtwbMTsttv3i zMDQ== X-Gm-Message-State: ACrzQf008Sxzsw3mHbipF9MtWjsWXJG8Eiv+V8E7EHvVg/nAi3BQLvEM ECd/c1SKBsCJ/ICw0oLA5SA= X-Received: by 2002:a63:1748:0:b0:46f:18be:4880 with SMTP id 8-20020a631748000000b0046f18be4880mr52638669pgx.128.1668016002702; Wed, 09 Nov 2022 09:46:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 09:46:42 -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 04/12] perf test: Replace record test workload with thloop Date: Wed, 9 Nov 2022 09:46:27 -0800 Message-Id: <20221109174635.859406-5-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?1749041784350786304?= X-GMAIL-MSGID: =?utf-8?q?1749041784350786304?= So that it can get rid of requirements for a compiler. $ sudo ./perf test -v 92 92: perf record tests : --- start --- test child forked, pid 740204 Basic --per-thread mode test Basic --per-thread mode test [Success] Register capture test Register capture test [Success] Basic --system-wide mode test Basic --system-wide mode test [Success] Basic target workload test Basic target workload test [Success] test child finished with 0 ---- end ---- perf record tests: Ok Signed-off-by: Namhyung Kim --- tools/perf/tests/shell/record.sh | 59 ++------------------------------ 1 file changed, 3 insertions(+), 56 deletions(-) diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh index e93b3a8871fe..4dff89e3a3fd 100755 --- a/tools/perf/tests/shell/record.sh +++ b/tools/perf/tests/shell/record.sh @@ -9,17 +9,13 @@ shelldir=$(dirname "$0") err=0 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) -testprog=$(mktemp /tmp/__perf_test.prog.XXXXXX) +testprog="perf test -w thloop" testsym="test_loop" cleanup() { rm -rf "${perfdata}" rm -rf "${perfdata}".old - if [ "${testprog}" != "true" ]; then - rm -f "${testprog}" - fi - trap - EXIT TERM INT } @@ -29,53 +25,6 @@ trap_cleanup() { } trap trap_cleanup EXIT TERM INT -build_test_program() { - if ! [ -x "$(command -v cc)" ]; then - # No CC found. Fall back to 'true' - testprog=true - testsym=true - return - fi - - echo "Build a test program" - cat < -#include -#include - -void test_loop(void) { - volatile int count = 1000000; - - while (count--) - continue; -} - -void *thfunc(void *arg) { - int forever = *(int *)arg; - - do { - test_loop(); - } while (forever); - - return NULL; -} - -int main(int argc, char *argv[]) { - pthread_t th; - int forever = 0; - - if (argc > 1) - forever = atoi(argv[1]); - - pthread_create(&th, NULL, thfunc, &forever); - test_loop(); - pthread_join(th, NULL); - - return 0; -} -EOF -} - test_per_thread() { echo "Basic --per-thread mode test" if ! perf record -o /dev/null --quiet ${testprog} 2> /dev/null @@ -96,8 +45,8 @@ test_per_thread() { return fi - # run the test program in background (forever) - ${testprog} 1 & + # run the test program in background (for 30 seconds) + ${testprog} 30 & TESTPID=$! rm -f "${perfdata}" @@ -205,8 +154,6 @@ test_workload() { echo "Basic target workload test [Success]" } -build_test_program - test_per_thread test_register_capture test_system_wide