Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp627440rwd; Wed, 14 Jun 2023 23:02:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6wVcElfUeV6HFFQc3lCoUIQa4ZkQzjWeBkqkBP5qTi9BQwoyksPXHMIqhK1KpOjStqB4KK X-Received: by 2002:a2e:9983:0:b0:2b3:379a:ba36 with SMTP id w3-20020a2e9983000000b002b3379aba36mr4789341lji.48.1686808953446; Wed, 14 Jun 2023 23:02:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686808953; cv=none; d=google.com; s=arc-20160816; b=kr3410CQEWYJ6L2iMp8BwWZyE7pfw19JV79kQ1+dqHt7q5mzaULzgasJhQAaEjlwfF ViAU5HsncOJbD7+4gUe22zAztEGcSnukh3DwLmEwNKIqi8/cg/xgd8GLUJFckQK38JzY KaCXiI0vWx6k9BacHcQZHQY37aeU4WmH8XzV8DXIramVfmj0TFNRikHVNs80gIOEnWJ4 vqRtWkRjN8fey1KuVUiL6jt6y1SJfFwwZbeRoQQJMZKDYmGQwXdt4pBTNht/16UIf1zx gxXqLFjyYC48dmLeNGmqZHChioDgduJLSO0IujNWP7fIihQurwwxnzsMIgV3U0oXBSK7 6ijg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=MsujUUkIkGPb1RjMWNMneyCY+OpEp4SMkg0gPmgmeUE=; b=NEOuZ76P9lohRv0f059FQMwOoDw27CaUCVCKF5Yie4rJfBnWSVMKaAZ/bOqxq665Pw 00ehS2KMuQlNz2/klkBCDMPhVP0+nlPP25K8k/QZvLcTOm4dyyined6XnWLCWj3EfQNc iJE1YFf3hFo8t2/JWPfu+37UNaNl7jR6Dv9mY0ngneKXpHnjZqi7Vb8kAW/n5Ra0+Ox8 t7OHnSIU3voeV+44v2w98QR+as/Xk4tzONkts7bPjrAFlPmmEJxfhggNrpOjrzEaNTYC DRU7lOB41nsDK06+cTAZ76elhw4ALiRVxtkOSzRlzNxOrpZVfKCKGzOKq0o1UP2Y+2Jn HXzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=mlAZdFUe; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x1-20020aa7dac1000000b00519e79bb057si1247146eds.474.2023.06.14.23.02.00; Wed, 14 Jun 2023 23:02:33 -0700 (PDT) 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=20221208 header.b=mlAZdFUe; 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 S233985AbjFOFvc (ORCPT + 99 others); Thu, 15 Jun 2023 01:51:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236343AbjFOFvT (ORCPT ); Thu, 15 Jun 2023 01:51:19 -0400 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D58B82961 for ; Wed, 14 Jun 2023 22:51:04 -0700 (PDT) Received: by mail-qt1-x831.google.com with SMTP id d75a77b69052e-3f98276f89cso106621cf.1 for ; Wed, 14 Jun 2023 22:51:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686808264; x=1689400264; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MsujUUkIkGPb1RjMWNMneyCY+OpEp4SMkg0gPmgmeUE=; b=mlAZdFUeclS9DSi1vYvLCC4ojnFxhm3xDeWmMBT9aqGrkJxw2o60JYFKNn50vwrFO6 E8F4Co3vexcVliW9eh/PVrGDfKBH7/MnXD8xAdQd1LVJD3ylzKUZw7EZkAh/dZtslWsI Rr7+MnhO6N20zguLB0CPKX0UcBEZ9PCM3KIWQQUK/6XMRkWFWTdPOPf3vKPIbOaLrF5V 3kFbwxPrdEXlmSZ8BRZfBol1J9ggJYBHUZsFYVu/ZjkeCno/OT5PAPvZ+6fNCERJqA9E 5N7GlefGzoEiF3Grks8X9qJf2UhP23xLMQhz1RbodiQSJmCQ1G5++70tWjU9NFzo/zOx 7TLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686808264; x=1689400264; h=content-transfer-encoding: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=MsujUUkIkGPb1RjMWNMneyCY+OpEp4SMkg0gPmgmeUE=; b=BWVKzMzhXl4Xm5JtFk1PzxZ5Q+eeHOyUXZ1TI10KdztIilchiOogYQ3/MTn3q42Rur jv6GTJVlXkGK89ZFPpHUo841aFva3p1vlT6fYxKVptwKk4dotLOcAvhctXBfjqPKiZGB 4cB4u+towN7XW1bSdSlLVfpY2/qd1WEYeim3rgsoeJDb5/YIGXZlnVnPE02O38lKvEHL tydXvYO0vPBUjUv3HvdoT5GK+kjXRag1XRe4MDCIuMqYKCfezKy6gD+7SAJwihN/p7AY 7pL74ICPP8YjD6HfGUefpWBRYN+j/6IQLbCyMGaP5CYelCxIufr+cAzGm8EeavOnQu98 mkwA== X-Gm-Message-State: AC+VfDyPfjAysjpkKmMY9uSfMPhmszlPj+EuEbaahmvoVFX2fx+FXaHw IctZj0hS8/BuAQQiqZ4zjGq8dgcVFXDc7/0wZTPexw== X-Received: by 2002:ac8:5b08:0:b0:3e3:8c75:461 with SMTP id m8-20020ac85b08000000b003e38c750461mr82908qtw.6.1686808263729; Wed, 14 Jun 2023 22:51:03 -0700 (PDT) MIME-Version: 1.0 References: <20230615001735.3643996-1-kan.liang@linux.intel.com> <20230615001735.3643996-4-kan.liang@linux.intel.com> In-Reply-To: <20230615001735.3643996-4-kan.liang@linux.intel.com> From: Ian Rogers Date: Wed, 14 Jun 2023 22:50:52 -0700 Message-ID: Subject: Re: [PATCH V2 3/8] perf stat,jevents: Introduce Default tags for the default mode To: kan.liang@linux.intel.com Cc: acme@kernel.org, mingo@redhat.com, peterz@infradead.org, namhyung@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, ak@linux.intel.com, eranian@google.com, ahmad.yasin@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_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 On Wed, Jun 14, 2023 at 5:18=E2=80=AFPM wrote: > > From: Kan Liang > > Introduce a new metricgroup, Default, to tag all the metric groups which > will be collected in the default mode. > > Add a new field, DefaultMetricgroupName, in the JSON file to indicate > the real metric group name. It will be printed in the default output > to replace the event names. > > There is nothing changed for the output format. > > On SPR, both TopdownL1 and TopdownL2 are displayed in the default > output. > > On ARM, Intel ICL and later platforms (before SPR), only TopdownL1 is > displayed in the default output. > > Suggested-by: Stephane Eranian > Signed-off-by: Kan Liang Reviewed-by: Ian Rogers Thanks, Ian > --- > tools/perf/builtin-stat.c | 4 ++-- > tools/perf/pmu-events/jevents.py | 5 +++-- > tools/perf/pmu-events/pmu-events.h | 1 + > tools/perf/util/metricgroup.c | 6 ++++++ > 4 files changed, 12 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c > index fc615bdeed4f..55601b4b5c34 100644 > --- a/tools/perf/builtin-stat.c > +++ b/tools/perf/builtin-stat.c > @@ -2154,14 +2154,14 @@ static int add_default_attributes(void) > * Add TopdownL1 metrics if they exist. To minimize > * multiplexing, don't request threshold computation. > */ > - if (metricgroup__has_metric(pmu, "TopdownL1")) { > + if (metricgroup__has_metric(pmu, "Default")) { > struct evlist *metric_evlist =3D evlist__new(); > struct evsel *metric_evsel; > > if (!metric_evlist) > return -1; > > - if (metricgroup__parse_groups(metric_evlist, pmu,= "TopdownL1", > + if (metricgroup__parse_groups(metric_evlist, pmu,= "Default", > /*metric_no_group= =3D*/false, > /*metric_no_merge= =3D*/false, > /*metric_no_thres= hold=3D*/true, > diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jev= ents.py > index 7ed258be1829..12e80bb7939b 100755 > --- a/tools/perf/pmu-events/jevents.py > +++ b/tools/perf/pmu-events/jevents.py > @@ -54,8 +54,8 @@ _json_event_attributes =3D [ > # Attributes that are in pmu_metric rather than pmu_event. > _json_metric_attributes =3D [ > 'pmu', 'metric_name', 'metric_group', 'metric_expr', 'metric_thresho= ld', > - 'desc', 'long_desc', 'unit', 'compat', 'metricgroup_no_group', 'aggr= _mode', > - 'event_grouping' > + 'desc', 'long_desc', 'unit', 'compat', 'metricgroup_no_group', > + 'default_metricgroup_name', 'aggr_mode', 'event_grouping' > ] > # Attributes that are bools or enum int values, encoded as '0', '1',... > _json_enum_attributes =3D ['aggr_mode', 'deprecated', 'event_grouping', = 'perpkg'] > @@ -307,6 +307,7 @@ class JsonEvent: > self.metric_name =3D jd.get('MetricName') > self.metric_group =3D jd.get('MetricGroup') > self.metricgroup_no_group =3D jd.get('MetricgroupNoGroup') > + self.default_metricgroup_name =3D jd.get('DefaultMetricgroupName') > self.event_grouping =3D convert_metric_constraint(jd.get('MetricCons= traint')) > self.metric_expr =3D None > if 'MetricExpr' in jd: > diff --git a/tools/perf/pmu-events/pmu-events.h b/tools/perf/pmu-events/p= mu-events.h > index 8cd23d656a5d..caf59f23cd64 100644 > --- a/tools/perf/pmu-events/pmu-events.h > +++ b/tools/perf/pmu-events/pmu-events.h > @@ -61,6 +61,7 @@ struct pmu_metric { > const char *desc; > const char *long_desc; > const char *metricgroup_no_group; > + const char *default_metricgroup_name; > enum aggr_mode_class aggr_mode; > enum metric_event_groups event_grouping; > }; > diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.= c > index 74f2d8efc02d..8b19644ade7d 100644 > --- a/tools/perf/util/metricgroup.c > +++ b/tools/perf/util/metricgroup.c > @@ -137,6 +137,11 @@ struct metric { > * output. > */ > const char *metric_unit; > + /** > + * Optional name of the metric group reported > + * if the Default metric group is being processed. > + */ > + const char *default_metricgroup_name; > /** Optional null terminated array of referenced metrics. */ > struct metric_ref *metric_refs; > /** > @@ -219,6 +224,7 @@ static struct metric *metric__new(const struct pmu_me= tric *pm, > > m->pmu =3D pm->pmu ?: "cpu"; > m->metric_name =3D pm->metric_name; > + m->default_metricgroup_name =3D pm->default_metricgroup_name; > m->modifier =3D NULL; > if (modifier) { > m->modifier =3D strdup(modifier); > -- > 2.35.1 >