From patchwork Tue Dec 13 05:00:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 32635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2638098wrr; Mon, 12 Dec 2022 21:10:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Thap8Jh322D8fLPXAFJi+Kc9xE+2YHaB7JYC7/bZVbiuGWdOEIgVsPMX57CvGsgvU67o/ X-Received: by 2002:a17:906:859a:b0:7c1:4bb2:f62c with SMTP id v26-20020a170906859a00b007c14bb2f62cmr13189981ejx.40.1670908212227; Mon, 12 Dec 2022 21:10:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670908212; cv=none; d=google.com; s=arc-20160816; b=0tjRXjG58KeL7CRGwvdXfTzyckdWqtCUMgnOGKv+i2BKSCQQaE/+JA4qvP9Q3pOBsu MSoE0egi1oNSBXVRLGhPJGqTpAU2xEpZbJNGY7uUhzKeYBlhlJeFa0qAy8r6gNUgxox2 Jj7q28oN+YJ/WoAvMpnVvXiXfMxBfP2Y7US1hEaSa7AHEnzizHfepzl94pyAhcqjv/Oe SPg8bVvZs2PYuLeHV4iaHzzcOCAJgjfwsUpO3A18F2DYmcdoOyU+M4taR/k66fzgS3dT DMfymcnB0BWS6vMf5JVKXjhbpoy/vZPRUkZRcSyo7kXHGaWUYsNB4ifuzAj4a8nNk34k j6cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=zFoUQZBIucfBHAzpZJT/16yExsgKsGPFpGFVDTFI4pg=; b=FEvRTZ9UUZsHyf1IW9vZwdpkXCyEop/nJJQfTF8L4Fv4NwmrtWE0+HRKYTQB6QUMKO NDT5ung/claXIJ5mAnPKT/Llt1nD3zvG+G1Vhq9Huq5DNSeGcCLHEMF1zRyt9MXHmkW/ uNcuIIi6EeFsuWbzNQXaClpuOZHJjTYvH79nAdz5NlOkAOUoGfW/UTlfXs3j6rqy4ms7 erC9iJMyohaVzxskykPm2FzpIj60fr0XBKkfAj/fGiN6IKenD5fWLb/i4PttbdYKT6nD U0iZn3Dq7FRvZKgY7yBsJ10wJk51JJPGFnkNUak+btvvpjEU6O9TK6ck0b+IhmQTy/EZ mqNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Hykjn0Yn; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cm27-20020a0564020c9b00b00463b0df4604si8410450edb.488.2022.12.12.21.09.48; Mon, 12 Dec 2022 21:10:12 -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=@google.com header.s=20210112 header.b=Hykjn0Yn; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234578AbiLMFGR (ORCPT + 99 others); Tue, 13 Dec 2022 00:06:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234494AbiLMFFT (ORCPT ); Tue, 13 Dec 2022 00:05:19 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 466371EC7B for ; Mon, 12 Dec 2022 21:02:36 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-3d3769a8103so157900317b3.17 for ; Mon, 12 Dec 2022 21:02:36 -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=zFoUQZBIucfBHAzpZJT/16yExsgKsGPFpGFVDTFI4pg=; b=Hykjn0YnZLB3e/W/M5ftjBk9hwanekR9hHKWeQOpHf9tKvhLm6AZNZDmkd4/NFAf25 yaemlLwxvCESBXC9dGW4Zxgkyy+cv0vxBY5LiOeuFMR010snN1MowWY+jAByoeUdtNML iSME37bprX3dSNrQ/tBAHgzu7x1rvv7dkgO175shpNCH0tKrWkOAYCvsLbTDXeTHRe9i mLuWmua3QlI8w2jF6CC+jt6gNgnTxrVDaxvF8D9kUPLE6e1kliKN+Jpp/o0RzhtpodfJ 4zj+o/5rBPzWkqyEUr7q2g3h1IL1nik+ahzHd4VL59+Kr3x+D6YSXu/n1jDOukXFC9Pe Bp3w== 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=zFoUQZBIucfBHAzpZJT/16yExsgKsGPFpGFVDTFI4pg=; b=uPb+mbdfZSQiNMPThsdwxXFAj7A7a5GnyKJCb06lXECSMPmGayIyor2Z/Uw45p1dT7 8+/wEzCvods/v/gQ3OqyCmsIbskRf6hkBlxFvkYBvPT5xfxJhCfEDtYBX7qR5owN283X /etu/6fr1x0NudTQA/bSuo1YfiyLv4Sj9b6a97Xh1AZAdEx9A4nMObaXfZt7IRxlolYC sYxie2WY8PwAxkeAkl9nKk/HnU9CovbhH0HEf7Y/pDWAK4t6oEdZM8wruRkhlIMHwaOt GHEIs6rRc4bveTARftWTo9jpc3sOP3yQ/e3DcSQXPx9sdB9Sxq7/gyoPZEvzkdetOMvL B+2A== X-Gm-Message-State: ANoB5pkrryQJrDkZHSIMqI6Wk5HDIaGzr8EvKH25DVOTYJTODac+3GlQ bgcQYE0qg8EUQHgHU97S3mgPxXVTpNPM X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:6b9f:864c:28da:e99b]) (user=irogers job=sendgmr) by 2002:a0d:e5c4:0:b0:388:7d2:566f with SMTP id o187-20020a0de5c4000000b0038807d2566fmr18942255ywe.346.1670907755509; Mon, 12 Dec 2022 21:02:35 -0800 (PST) Date: Mon, 12 Dec 2022 21:00:43 -0800 In-Reply-To: <20221213050043.1199380-1-irogers@google.com> Message-Id: <20221213050043.1199380-10-irogers@google.com> Mime-Version: 1.0 References: <20221213050043.1199380-1-irogers@google.com> X-Mailer: git-send-email 2.39.0.rc1.256.g54fd8350bd-goog Subject: [PATCH v1 9/9] 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-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_SBL_A,USER_IN_DEF_DKIM_WL 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752074249036283906?= X-GMAIL-MSGID: =?utf-8?q?1752074249036283906?= 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. Signed-off-by: Ian Rogers --- tools/perf/pmu-events/Build | 3 ++- tools/perf/pmu-events/jevents.py | 4 ++++ 2 files changed, 6 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 c98443319145..e9eba51e8557 100755 --- a/tools/perf/pmu-events/jevents.py +++ b/tools/perf/pmu-events/jevents.py @@ -886,12 +886,16 @@ 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='Model such as skylake, normally "all"', default='all') ap.add_argument( 'starting_dir', type=dir_path,