From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87E71C27C76 for ; Thu, 26 Jan 2023 01:21:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235788AbjAZBVI (ORCPT ); Wed, 25 Jan 2023 20:21:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230288AbjAZBVE (ORCPT ); Wed, 25 Jan 2023 20:21:04 -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 B2A0B64DBD for ; Wed, 25 Jan 2023 17:20:34 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5062f3a2977so3652537b3.21 for ; Wed, 25 Jan 2023 17:20:34 -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=LYQmk36LwpH1amM5NS/JZnLvaK2yBpvx1p5Vz+enrHo=; b=g5kNYx2i/3N21JTuAlpQ2Fzr0z4yS5BF5bpwKl6uBD9aJAt61CO1Cxf2wOs6Z6Le4j woG9v16pTQyq6MRJ3l0+3Q8SwZomo4kn2dMJ78fwpX9TiUULdeKPKPQMgJLHQXfeSljh Tz8qAv3zT6uOZvOFT6MlpOMURNETaASAXkZOz5R0qIHG4KfR+qUenefEszI6IbhmlxAo DpbMgACRE0CV+GOVDn/CN0GOTKRfvezhoZgYafaFwo4iXRIsRJVYG9QTqaDNxbb/vvIh VahpBNlPSFCRJFvx7tii4AcdZRcpXXE8FeDomLyGIK6NHSUIJ2OeVzRVYe+oWOrxZQw+ LZiA== 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=LYQmk36LwpH1amM5NS/JZnLvaK2yBpvx1p5Vz+enrHo=; b=J5im+tC9kNPpDB5OCqoqYBdTP5seq40ex4vpnCZ+k+58qR3pTxQXw83Qvbit4saPEU Vi3wxhFv751ki4gi+nlZkndbvWiwr3RFpth8IaFwwEgX11DZdwihukMJ5PM7hgbWcwPi wui3CqN9PCV4Js0PXlOSs9WjzWsOTjTdiKlCdHjckvHTyuPJZDuBG/yNRxU0tEy7rjHY TT+x8pfEIg996On1WTned1IZP7UtWF7M/mc3ZWPE7etP1KJcoDa7cvbmKd32nrewdZpa W1pGKMutAXZgbv/VZI0Kjj5psy223cqmXh2nvOSL4lsWgEqXm+MVR49erpGwYYJUxuf6 FS0w== X-Gm-Message-State: AFqh2kr/l4VdEPO6Qv43MsO69qGYgQWopTwb+pTFxbzB7c/ajsSx11sT 2hn5DUdxVzdoE/prEcGXscio4iLUiv8j X-Google-Smtp-Source: AMrXdXtJyXEuVpA/fKT4Gs+OHOHp62Ve2MgKmevUrheQ5iCrugGv01d4Et9NsO/jcVDyYhqORA5ZqbJKTjoZ X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:568d:4d98:b468:b025]) (user=irogers job=sendgmr) by 2002:a81:5c02:0:b0:4e2:db5a:2c2c with SMTP id q2-20020a815c02000000b004e2db5a2c2cmr4504216ywb.202.1674696032312; Wed, 25 Jan 2023 17:20:32 -0800 (PST) Date: Wed, 25 Jan 2023 17:18:53 -0800 In-Reply-To: <20230126011854.198243-1-irogers@google.com> Message-Id: <20230126011854.198243-12-irogers@google.com> Mime-Version: 1.0 References: <20230126011854.198243-1-irogers@google.com> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog Subject: [PATCH v4 11/12] 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.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. Signed-off-by: Ian Rogers --- tools/perf/pmu-events/Build | 3 ++- tools/perf/pmu-events/jevents.py | 14 ++++++++++++++ 2 files changed, 16 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..2bcd07ce609f 100755 --- a/tools/perf/pmu-events/jevents.py +++ b/tools/perf/pmu-events/jevents.py @@ -599,6 +599,8 @@ const struct pmu_events_map pmu_events_map[] = { else: metric_tblname = 'NULL' metric_size = '0' + if event_size == '0' and metric_size == '0': + continue cpuid = row[0].replace('\\', '\\\\') _args.output_file.write(f"""{{ \t.arch = "{arch}", @@ -888,12 +890,24 @@ 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 _args.model != 'all' and item.is_dir(): + # Check if the model matches one in _args.model. + if len(parents) == _args.model.split(',')[0].count('/'): + # We're testing the correct directory. + item_path = '/'.join(parents) + ('/' if len(parents) > 0 else '') + item.name + if 'test' not in item_path and item_path 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, the model must include the implementor +such as "arm/cortex-a34".''', + default='all') ap.add_argument( 'starting_dir', type=dir_path, -- 2.39.1.456.gfc5497dd1b-goog From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 DEC63C27C76 for ; Thu, 26 Jan 2023 01:30:19 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4P2NSB2fNrz3fXs for ; Thu, 26 Jan 2023 12:30:18 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=g5kNYx2i; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=flex--irogers.bounces.google.com (client-ip=2607:f8b0:4864:20::114a; helo=mail-yw1-x114a.google.com; envelope-from=3ynxrywckdhcdmjbzmnbjjbgz.xjhgdipskkx-yzqgdnon.jugvwn.jmb@flex--irogers.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=g5kNYx2i; dkim-atps=neutral Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4P2NDy2qdVz3cgp for ; Thu, 26 Jan 2023 12:20:34 +1100 (AEDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5065604854eso3777437b3.16 for ; Wed, 25 Jan 2023 17:20:34 -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=LYQmk36LwpH1amM5NS/JZnLvaK2yBpvx1p5Vz+enrHo=; b=g5kNYx2i/3N21JTuAlpQ2Fzr0z4yS5BF5bpwKl6uBD9aJAt61CO1Cxf2wOs6Z6Le4j woG9v16pTQyq6MRJ3l0+3Q8SwZomo4kn2dMJ78fwpX9TiUULdeKPKPQMgJLHQXfeSljh Tz8qAv3zT6uOZvOFT6MlpOMURNETaASAXkZOz5R0qIHG4KfR+qUenefEszI6IbhmlxAo DpbMgACRE0CV+GOVDn/CN0GOTKRfvezhoZgYafaFwo4iXRIsRJVYG9QTqaDNxbb/vvIh VahpBNlPSFCRJFvx7tii4AcdZRcpXXE8FeDomLyGIK6NHSUIJ2OeVzRVYe+oWOrxZQw+ LZiA== 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=LYQmk36LwpH1amM5NS/JZnLvaK2yBpvx1p5Vz+enrHo=; b=le+gSKH/7FtbaXOcxVUWGeMo/Hp/taVhiOQmj3Nyh7Y9+sMEpLSMIdaVnyZ1mmMi9N OyuBUW9c5Jk8cm/DSC7XCt/ritKcV/S7BXuQ42K/4pjgQRMrx3EX1BCsJiL7qLE6n2p0 3FdVXolHbIMnsOgPB2bJaBS8t1tPQQBiXiDUZ4JsU4MG5EA2VHjVGZrrnCUUlwU3ZXts 0J+yk6pUAuPsyQDfaMfSJB70DsK+jY+Ddhz3hM6VxcTImGCWNkUY1C16+WeQBB7MUVG0 6p/xHpBxlhVrPtV3CO1nkKSjtY4CdP80oiduqunRo38/HxW8t0ftl5zzj/QJN/cb+Mcp spOA== X-Gm-Message-State: AFqh2koIrr4nVJx+UEPkZjx56eQR8bN0H0wPxY3NVsWfrEuMIgcbLfpY j1Qm8VRI0M6Yxwl0ey4DPEB1wOkmmiuu X-Google-Smtp-Source: AMrXdXtJyXEuVpA/fKT4Gs+OHOHp62Ve2MgKmevUrheQ5iCrugGv01d4Et9NsO/jcVDyYhqORA5ZqbJKTjoZ X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:568d:4d98:b468:b025]) (user=irogers job=sendgmr) by 2002:a81:5c02:0:b0:4e2:db5a:2c2c with SMTP id q2-20020a815c02000000b004e2db5a2c2cmr4504216ywb.202.1674696032312; Wed, 25 Jan 2023 17:20:32 -0800 (PST) Date: Wed, 25 Jan 2023 17:18:53 -0800 In-Reply-To: <20230126011854.198243-1-irogers@google.com> Message-Id: <20230126011854.198243-12-irogers@google.com> Mime-Version: 1.0 References: <20230126011854.198243-1-irogers@google.com> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog Subject: [PATCH v4 11/12] 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 Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ian Rogers , Perry Taylor , Caleb Biggers , Stephane Eranian Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 | 14 ++++++++++++++ 2 files changed, 16 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..2bcd07ce609f 100755 --- a/tools/perf/pmu-events/jevents.py +++ b/tools/perf/pmu-events/jevents.py @@ -599,6 +599,8 @@ const struct pmu_events_map pmu_events_map[] = { else: metric_tblname = 'NULL' metric_size = '0' + if event_size == '0' and metric_size == '0': + continue cpuid = row[0].replace('\\', '\\\\') _args.output_file.write(f"""{{ \t.arch = "{arch}", @@ -888,12 +890,24 @@ 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 _args.model != 'all' and item.is_dir(): + # Check if the model matches one in _args.model. + if len(parents) == _args.model.split(',')[0].count('/'): + # We're testing the correct directory. + item_path = '/'.join(parents) + ('/' if len(parents) > 0 else '') + item.name + if 'test' not in item_path and item_path 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, the model must include the implementor +such as "arm/cortex-a34".''', + default='all') ap.add_argument( 'starting_dir', type=dir_path, -- 2.39.1.456.gfc5497dd1b-goog From mboxrd@z Thu Jan 1 00:00:00 1970 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 A60B8C54E94 for ; Thu, 26 Jan 2023 01:24:45 +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=qBm67fpttQG72VyGI1Oel29425M2zJ/Z8GVWLvH3+y0=; b=jtDS/TLYTR2C7ju/Xpr+TpjP+J 0HupUp3aZSnNERYfZFuR7vnmG/WrHskXf3xUYw6giDVX3cJDQR7fU3shCH+iiTLwfFTsjWfTG2m0R IKRSVooeywTI8NXs7Rb+xo+XxOUwQn4VFSp492G2ZG5w3OYB8FAaKzkWjMo6cjSSimYczSlMMrLnt sDff0zfQ57A9HAoGYxneZ/G26I3K+pMy+nUSZGOn7XrwoaNTHfenuzuUXCmlIxLYTmZe02SMyG+5g WJ9h/MSRN9BsCp4lW1Ex9lCzGQWnGdI2cuzR14DsRgOo8WK1l3vCYT6cOsAuy1W93Fol4q30K4wdo xfLPklTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKqzD-009KuL-8x; Thu, 26 Jan 2023 01:23:31 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKqwM-009Jgd-3B for linux-arm-kernel@lists.infradead.org; Thu, 26 Jan 2023 01:20:35 +0000 Received: by mail-yb1-xb49.google.com with SMTP id c2-20020a25a2c2000000b008016611ca77so352850ybn.9 for ; Wed, 25 Jan 2023 17:20:33 -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=LYQmk36LwpH1amM5NS/JZnLvaK2yBpvx1p5Vz+enrHo=; b=g5kNYx2i/3N21JTuAlpQ2Fzr0z4yS5BF5bpwKl6uBD9aJAt61CO1Cxf2wOs6Z6Le4j woG9v16pTQyq6MRJ3l0+3Q8SwZomo4kn2dMJ78fwpX9TiUULdeKPKPQMgJLHQXfeSljh Tz8qAv3zT6uOZvOFT6MlpOMURNETaASAXkZOz5R0qIHG4KfR+qUenefEszI6IbhmlxAo DpbMgACRE0CV+GOVDn/CN0GOTKRfvezhoZgYafaFwo4iXRIsRJVYG9QTqaDNxbb/vvIh VahpBNlPSFCRJFvx7tii4AcdZRcpXXE8FeDomLyGIK6NHSUIJ2OeVzRVYe+oWOrxZQw+ LZiA== 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=LYQmk36LwpH1amM5NS/JZnLvaK2yBpvx1p5Vz+enrHo=; b=acfUCHUg0lr2tI/QGVpNhSki8kXwvFNenzYBhbAWvdgRRcPf+Rqg3jBA6VBZ7YivCo JDsARos+LOstfV4Z8NTfSl7XD1QKjbE4gqaJTDOWVdjPXV3H0KOxDD2G6FOigh97thtR 1YU/LPW8AIVsRzE+JKWKmyTw3WgIIfdYdbfpkSGSfWHv819ZqugiegjG2ymzv5AvpwX4 vEdg3Mbslw571TC1jAnCc6C32fShPT/F+LRaP3QPjzf2NUA9n8HKG8QWEz2Prx8/e/sf 1xhGDJeldDccUpU5FVIcgZbuqNgTIpdVyVgH8BZbAmFFEj8kI/iD5nbIrjxmovXgL6sA Vyxg== X-Gm-Message-State: AFqh2kqJQLvSwkDS8SeeZJtim1cAkobUQjHo8WLZM6iCNqcaTI6Eoexe AXxurB9pne1fa+pmBNALyE5OYLJR8VWp X-Google-Smtp-Source: AMrXdXtJyXEuVpA/fKT4Gs+OHOHp62Ve2MgKmevUrheQ5iCrugGv01d4Et9NsO/jcVDyYhqORA5ZqbJKTjoZ X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:568d:4d98:b468:b025]) (user=irogers job=sendgmr) by 2002:a81:5c02:0:b0:4e2:db5a:2c2c with SMTP id q2-20020a815c02000000b004e2db5a2c2cmr4504216ywb.202.1674696032312; Wed, 25 Jan 2023 17:20:32 -0800 (PST) Date: Wed, 25 Jan 2023 17:18:53 -0800 In-Reply-To: <20230126011854.198243-1-irogers@google.com> Message-Id: <20230126011854.198243-12-irogers@google.com> Mime-Version: 1.0 References: <20230126011854.198243-1-irogers@google.com> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog Subject: [PATCH v4 11/12] 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-20230125_172034_194943_91649B10 X-CRM114-Status: GOOD ( 16.90 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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. Signed-off-by: Ian Rogers --- tools/perf/pmu-events/Build | 3 ++- tools/perf/pmu-events/jevents.py | 14 ++++++++++++++ 2 files changed, 16 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..2bcd07ce609f 100755 --- a/tools/perf/pmu-events/jevents.py +++ b/tools/perf/pmu-events/jevents.py @@ -599,6 +599,8 @@ const struct pmu_events_map pmu_events_map[] = { else: metric_tblname = 'NULL' metric_size = '0' + if event_size == '0' and metric_size == '0': + continue cpuid = row[0].replace('\\', '\\\\') _args.output_file.write(f"""{{ \t.arch = "{arch}", @@ -888,12 +890,24 @@ 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 _args.model != 'all' and item.is_dir(): + # Check if the model matches one in _args.model. + if len(parents) == _args.model.split(',')[0].count('/'): + # We're testing the correct directory. + item_path = '/'.join(parents) + ('/' if len(parents) > 0 else '') + item.name + if 'test' not in item_path and item_path 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, the model must include the implementor +such as "arm/cortex-a34".''', + default='all') ap.add_argument( 'starting_dir', type=dir_path, -- 2.39.1.456.gfc5497dd1b-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel