Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1289692rwb; Wed, 16 Nov 2022 15:16:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf6RNzzWFHDmDU4Ooh/wGyi3E3MctyQ1HwoR/yvdRso5wS0eppViPi5B9gS9GXBn5TIkkE90 X-Received: by 2002:a17:906:26c6:b0:7ae:d8f:893c with SMTP id u6-20020a17090626c600b007ae0d8f893cmr38067ejc.359.1668640598676; Wed, 16 Nov 2022 15:16:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668640598; cv=none; d=google.com; s=arc-20160816; b=jcd1cstt4yRf8B8/wCbDENK+1aVNBtymDTd+mJBP6puLan+Gw7+D3kJqegO055HPfP Q5eugqGOrXXBgtoRkcdsGY0qZum7cy63vYvlEdFBqrzw7Yq+65VbmSXgndlbQFPsHYWe sjACKvMs+S9UqNYR2w/mQ0y7nW1PFE6RMJYZ3Z2y5k3YKeC8Oe4ElnDSyhY1MomlzVDu /t6tTltmnRFAmCVan2YM+XXMLGZELiC6iqUt6D1+awXeNaz0TAFOd85faWpPJia0KRpe sa7IWD1XfHaGOLz6P/OkgxUd/Pu7pygyUBmN0XndwwQ3Hois4WHju6APxuGg9+5ZdsNY b/rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=exwunUZ/kcqkAH6HVxuBc9I6bVs9+z6PsdO9s6kIF5o=; b=ibxj9jJB3siwTi8ZmssDJnv/CnupEe2y9lce9M6xasrmSHEZcbjeP9VO0iDxeHX8N8 Sldw0V9tM7tZ8o3wRZPHURbzRiuqJ3GtFsIeII8nKNQF+OuBKaSxj8pxQVYBuu8U80l+ fOBzyLFNzrWlxS/16ybUbTeUMUUx9nlWp5HZFerTSxkjA/ADM2AKzST/OhNUq1tAgFuQ 5544T8WN2oHM9RSBFIKOHCvve6yXTsvO307AKPxDBZxN3w+U+9bjRYK/44kNHd1YkyNu ohQTARzbPk5Hzmviz4Sv7/pHuMag9l2pmGH0FgJBPL5lIG8waAd2tIQUyvnFE6kvBmsx 0uKw== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kl14-20020a170907994e00b007829f6fed9dsi12571148ejc.232.2022.11.16.15.16.16; Wed, 16 Nov 2022 15:16:38 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233553AbiKPXHE (ORCPT + 91 others); Wed, 16 Nov 2022 18:07:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229641AbiKPXHC (ORCPT ); Wed, 16 Nov 2022 18:07:02 -0500 Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A92A352882; Wed, 16 Nov 2022 15:07:01 -0800 (PST) Received: by mail-oi1-f180.google.com with SMTP id v81so58391oie.5; Wed, 16 Nov 2022 15:07:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=exwunUZ/kcqkAH6HVxuBc9I6bVs9+z6PsdO9s6kIF5o=; b=QHVRNnJluOIk5mwqA/oPdyz5t8RgnM+Y5gWIUPvPINw3WhpH3TDrLq9nQiobVEbZ8Q sheojxhE/Ui3wqsbrkoXb+GQCEwd9hRBePYa698FzXDr0ApU2nIc9taJMexXXgi7uPfx Ep84OrW/9ciGa1uCJhQILNJUnx7Uw6YtLjiWMjkCA8SjYflr4GVTT+JPXCxMMbGDiCTw ++P0oHNwgISSUZ3BGAXVnH9CyNE2bCfFf7oTo6WB5bu/B5Pl/11CDZszFoR2XJyjwWKt 1YJzGzVc/yi7BrphN9SCl4xT5/1HoC8289+q9KANOgVbyJgdg1Un7xjDMPX8B7Ih+8YI w1IA== X-Gm-Message-State: ANoB5plihTjmzolTDq2PUKoV2DzipqyenqzR3k3b6Y1/Qeb+juQJ+fFc z4ViMVgjBzL8mR2rLYiTsUgKNudgdGAArowzTUE= X-Received: by 2002:aca:654d:0:b0:35a:812c:3eae with SMTP id j13-20020aca654d000000b0035a812c3eaemr2752516oiw.218.1668640020942; Wed, 16 Nov 2022 15:07:00 -0800 (PST) MIME-Version: 1.0 References: <20221110181920.84900-1-namhyung@kernel.org> <20221110181920.84900-10-namhyung@kernel.org> <86c42368-cbbb-2e13-ce7d-31865a12bb81@arm.com> In-Reply-To: <86c42368-cbbb-2e13-ce7d-31865a12bb81@arm.com> From: Namhyung Kim Date: Wed, 16 Nov 2022 15:06:49 -0800 Message-ID: Subject: Re: [PATCH 09/12] perf test: Add 'brstack' test workload To: James Clark 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 Hi James, On Wed, Nov 16, 2022 at 3:39 AM James Clark wrote: > > > > 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; Yep, that's more intuitive. Will change! Thanks, Namhyung