From patchwork Tue Jan 24 06:33:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13113567 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D70AEC25B4E for ; Tue, 24 Jan 2023 06:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=73cEaSozuQBzYSPaATTAp5EGXqLsFeAaTYUDHRfncY0=; b=qMrGhTGl4PLDnYBkW+3TisLGVy Y4GYH5QsaDjiURmxSPxO0HFynhzNVAub37hO/75O+Hv2GuisIUZnJFS1+cDNXizItV6Ic9qVRx72U 7hufFoU21TQSXWWT0ZbfKoL9Q9VHSF87UF4fcn+rt+iinKQqYhOyA7vHSkSiagZFqlUVZRFyWgXQ/ hW/7ApcojwkLXRQcG3fVvrDqiWyeud5RJ8P3wELfQ7arqYWJA/mZ1OKUdA2jcLlptkAbANVPbQu1I xjQlqPzES6z7cgnFBh7Xhnvc5eaAWrr8dagLPwZ12VbVXaCaTuHXT2h793JrTfYWm2rIkd0eAgOQ3 n9MyCn6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKCvZ-002XLz-5k; Tue, 24 Jan 2023 06:37:05 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKCtW-002WP5-DS for linux-arm-kernel@lists.infradead.org; Tue, 24 Jan 2023 06:34:59 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-4d4b54d0731so143795357b3.18 for ; Mon, 23 Jan 2023 22:34:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=9CQf7qwf816ywxYe0MGvN2DXuLUyDOCX6uxlx6OMLsg=; b=E/aDkM7K/lA4FaRlkpePHCMT3UVODvM17F6GurRPNTGwzR4OIm/m3KHjNuJWMKh8Du shSVKsu9+W4MoZRyUeStedTnW1kfbIwvd15RkKq28atlPKIhjdpYnvGoaDsvUS5yL0+5 WM0WNKkEab2aKJpq07OjmYwyxbkFWrmTRvfkMmW9qztdWsDFxsxIVPOIOgZnjPyk9bVE Gjee1xhFG2B18924+GoEvcEEh1mcGkiW1eiaZZNDqwlNxpKKxtqofR6tpSfzTjfzPt92 QHNfUKeKHmiH2OkS72MKotSYJydW6zVrQF07xDsX/nn7fEQ+QB/D9IT4iQZJZUyfVIcb mo6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9CQf7qwf816ywxYe0MGvN2DXuLUyDOCX6uxlx6OMLsg=; b=fAVYj/xgoTW6MLESq716bDU5mptwUbHNtHBme5gSya51naQn4YPslbpSdnw7KvWfvS wIueD6wC9FQZWZEObsZ39+5bhurLfNxnKs/A++c8uo1hOkG9nfdTAwLZGWx9OBScK3mt +05kC0V3VCLet8LXATSBnoLHfkFAzdJeQxHN+d6LeuQd5O3jumUUShces7W+hiwWTntz /Pph0/Pil4CvDNHq2pbmhntx6/h6WQcsEnQQazHXaStUWG3zcbKdCnn8Yp4918xsp1Zr /Tp9O4sppyajFi1Ov4qi8eJav9iVvEBtz5zXMAh4mc5ht3y+ufGAR9dRIuAm6e3WQeCy aeOA== X-Gm-Message-State: AFqh2krk5P5NRMi5MpvFi7puExp7ybjp9yJhTifnEP8L4fKduXbUrFmy mGCZIifFNrlVCPkjTDFOFcSeTGawgMGY X-Google-Smtp-Source: AMrXdXtzoentlV7UmGLWsQR0SkxQ5u2HBNb4nnRJgT9cvccOfzAGu8MysRvoSaTaE2B0Dti7zL52DJHCOUj3 X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:460d:1b4a:acb8:ae9a]) (user=irogers job=sendgmr) by 2002:a25:d4d3:0:b0:7d1:f411:4f5a with SMTP id m202-20020a25d4d3000000b007d1f4114f5amr3000373ybf.599.1674542096878; Mon, 23 Jan 2023 22:34:56 -0800 (PST) Date: Mon, 23 Jan 2023 22:33:20 -0800 In-Reply-To: <20230124063320.668917-1-irogers@google.com> Message-Id: <20230124063320.668917-12-irogers@google.com> Mime-Version: 1.0 References: <20230124063320.668917-1-irogers@google.com> X-Mailer: git-send-email 2.39.0.246.g2a6d74b583-goog Subject: [PATCH v3 11/11] perf jevents: Add model list option From: Ian Rogers To: John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Kan Liang , Kim Phillips , Florian Fischer , Ravi Bangoria , Xing Zhengjun , Rob Herring , Kang Minchul , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Sandipan Das , Jing Zhang , linuxppc-dev@lists.ozlabs.org, Kajol Jain Cc: Stephane Eranian , Perry Taylor , Caleb Biggers , Ian Rogers X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230123_223458_506765_3666EE5C X-CRM114-Status: GOOD ( 15.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This allows the set of generated jevents events and metrics be limited to a subset of the model names. Appropriate if trying to minimize the binary size where only a set of models are possible. On ARM64 the --model selects the implementor rather than model. Signed-off-by: Ian Rogers --- tools/perf/pmu-events/Build | 3 ++- tools/perf/pmu-events/jevents.py | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build index 15b9e8fdbffa..a14de24ecb69 100644 --- a/tools/perf/pmu-events/Build +++ b/tools/perf/pmu-events/Build @@ -10,6 +10,7 @@ JEVENTS_PY = pmu-events/jevents.py ifeq ($(JEVENTS_ARCH),) JEVENTS_ARCH=$(SRCARCH) endif +JEVENTS_MODEL ?= all # # Locate/process JSON files in pmu-events/arch/ @@ -23,5 +24,5 @@ $(OUTPUT)pmu-events/pmu-events.c: pmu-events/empty-pmu-events.c else $(OUTPUT)pmu-events/pmu-events.c: $(JSON) $(JSON_TEST) $(JEVENTS_PY) pmu-events/metric.py $(call rule_mkdir) - $(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) $(JEVENTS_ARCH) pmu-events/arch $@ + $(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) $(JEVENTS_ARCH) $(JEVENTS_MODEL) pmu-events/arch $@ endif diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py index 627ee817f57f..764720858950 100755 --- a/tools/perf/pmu-events/jevents.py +++ b/tools/perf/pmu-events/jevents.py @@ -888,12 +888,19 @@ def main() -> None: action: Callable[[Sequence[str], os.DirEntry], None]) -> None: """Replicate the directory/file walking behavior of C's file tree walk.""" for item in os.scandir(path): + if (len(parents) == 0 and item.is_dir() and _args.model != 'all' and + 'test' not in item.name and item.name not in _args.model.split(',')): + continue action(parents, item) if item.is_dir(): ftw(item.path, parents + [item.name], action) ap = argparse.ArgumentParser() ap.add_argument('arch', help='Architecture name like x86') + ap.add_argument('model', help='''Select a model such as skylake to +reduce the code size. Normally set to "all". For architectures like +ARM64 with an implementor/model, this selects the implementor.''', + default='all') ap.add_argument( 'starting_dir', type=dir_path,