Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp557859rwb; Wed, 16 Nov 2022 04:47:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Uj4RMw0oRqw/y2HMFQlW1Jx16pYClRb9rw89pLZRPtMWTqg/qQfwS21o0RIjydUp5f1YB X-Received: by 2002:a17:907:6d07:b0:78d:a836:1d88 with SMTP id sa7-20020a1709076d0700b0078da8361d88mr17570769ejc.470.1668602869796; Wed, 16 Nov 2022 04:47:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668602869; cv=none; d=google.com; s=arc-20160816; b=lDLS1V98IsBPHW4WcZqVQfY14YqBSG1fmgEZzR2zAVIV3Bd7Zrs9Xcum34cwARa2Od 0n59JY6JT6dBzeaJ1bKZoafIw0KZEKkihghXFtWCe+RePGTyF2+uCbjllmk6KA+lP73w 55vcftffHsHmgJGxIRkte+TZNDEX1/Dnwz2dHAQKDiA1/RP1BCr0+4X8XiB0aTQhkFXP +JQl6EiITNFdxsoaRHalhP/GBkE+fBmKosrmnTJvx20f79HvzJLTlVfrDdToM/Y/PNC4 eD8pGkvioBROGlHKZx/4L/F2rjfN57BGNLfrZQhyszrzpFMGlcdFCeTyiZ1LsVtq3++p xwGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=IKwlmsaHOk/sY05/SOu11KzEO+4xKqFrmHxJyyZCcYs=; b=RdtycBX0r/wbVALz/nfPwJHyXmGOO3J37olB1ACyW0ARcTx2Hmwy0xPP8BK7olVIFw GEx9Jj+ryMrjtv+NDQdXyl68Mwd/6ITE2n9xInfvPYXvGcq85y/uj7fZq0m3nom84+pD swzy2K8pkGoEVaL8t3dvpJ5VprDfbtatoKthMCtXQRvN5xNKCXXRyG144dNLvVg+JGqt No6JR352vfkSXd0BdZsnGD+y4ZyMQIQj4YnrYCQJ5ZSqcD+pNrnO+2GcU4XTIWCFL5L1 h24MTqaer1x7dr9B9sb0vQ4tYxNncJMPVenhKkJ7V0a/4j3vGcMlTnKP4ULOP80XAvAH NJfg== 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=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a056402278600b00467570d605esi13258430ede.608.2022.11.16.04.47.28; Wed, 16 Nov 2022 04:47:49 -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; 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=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232775AbiKPLvq (ORCPT + 91 others); Wed, 16 Nov 2022 06:51:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233383AbiKPLvO (ORCPT ); Wed, 16 Nov 2022 06:51:14 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D1EF94093C; Wed, 16 Nov 2022 03:39:33 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E13701477; Wed, 16 Nov 2022 03:39:39 -0800 (PST) Received: from [10.1.39.20] (e121896.cambridge.arm.com [10.1.39.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5008C3F663; Wed, 16 Nov 2022 03:39:31 -0800 (PST) Message-ID: <86c42368-cbbb-2e13-ce7d-31865a12bb81@arm.com> Date: Wed, 16 Nov 2022 11:39:29 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH 09/12] perf test: Add 'brstack' test workload Content-Language: en-US To: Namhyung Kim Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Leo Yan , German Gomez , Zhengjun Xing , Athira Jajeev , Arnaldo Carvalho de Melo , Jiri Olsa References: <20221110181920.84900-1-namhyung@kernel.org> <20221110181920.84900-10-namhyung@kernel.org> From: James Clark In-Reply-To: <20221110181920.84900-10-namhyung@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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 On 10/11/2022 18:19, Namhyung Kim wrote: [...] > + > +#define BENCH_RUNS 999999 > + > +static volatile int cnt; > + > +static void brstack_bar(void) { > +} /* return */ > + > +static void brstack_foo(void) { > + brstack_bar(); /* call */ > +} /* return */ > + > +static void brstack_bench(void) { > + void (*brstack_foo_ind)(void) = brstack_foo; > + > + if ((cnt++) % 3) /* branch (cond) */ > + brstack_foo(); /* call */ > + brstack_bar(); /* call */ > + brstack_foo_ind(); /* call (ind) */ > +} > + > +static int brstack(int argc, const char **argv) > +{ > + if (argc > 0) > + cnt = atoi(argv[0]); > + > + while (1) { > + if ((cnt++) > BENCH_RUNS) > + break; Hi Namhyung, I'm reading this as you can specify the number of loops as an argument. In that case should it be more like this? int num_loops = argc>0 ? atoi(argv[0]) : BENCH_RUNS; if ((cnt++) > num_loops) break; > + brstack_bench();/* call */ > + } /* branch (uncond) */ > + return 0; > +} > + > +DEFINE_WORKLOAD(brstack);