Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1310359ybh; Sun, 19 Jul 2020 15:38:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzL/vTAuQ5boSvxsZUtxBR+cAysAwtBJqQqU7NxAa8v57bvpDjOPBXLrV/+HAPsFQqQq5XT X-Received: by 2002:aa7:c656:: with SMTP id z22mr19647307edr.101.1595198288041; Sun, 19 Jul 2020 15:38:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595198288; cv=none; d=google.com; s=arc-20160816; b=SZrqc2ROq8/vH2a3BRBncJuOsA66yhP4qk0LlJs/Pto1ftHpcNKs1HJ3eLWayirkwq iA0sXr6YDhuex9DguneNmXJ7/nrjDs3aSRWCFkSe6p7uRz+mdmmkrhLKj7BhkxfK1cNT Mniybu7G++4I1tNie3WPIb3hC+oTp1SSld/YQAuxzOM9+4oeprI4NbqHzIaLU7j1xYFZ llBnPiJBDXWWNYCHQVDMcZsBHAzR36RmLEcG82vdBnbA0kFbxX630jpT8yX2YrtxHGsv Og/1J9j34bQjuz7W6hGoGUvRcPPGl69dV/zasC2BWJ8vltthSTkybWFCmr0wK02Wa7j0 mg2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=FvG5reSg9l5TH3VxmyNLzPs9V51oowG1ILpSonp6Wuc=; b=bFsX9CF8jDQPGIpO8Ls5e53VvkDldoI/4Ilko+rjStQaUoL55e85diUJjvdm6P+Xop JqJkh5FE+KztXmV+hgVDSyKz7oLvQBFDKswqUC+fXd0qtJOCnk6JHI2RDpaxyb+/6Tox 8JeSzFvXbn7XATMban03d4+zNrjdEuq7KZzr1J8Gz01MpKFAT5o6eECvpgQNCCZ8HlO7 3xkShaXOV2MZOW18P2WPXanQimKr6HZ4b54VMi1QV7tHkQDaseznGamzKCXG+CkNDY3I KkKUkpEnWZWly0aNaYdj3zUOaUFhRjBhJFHToK2I6IHM7gYbgnpADY3OFC6OHnQnZHOP Mv0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hmQRpfGh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si9093717ejj.380.2020.07.19.15.37.45; Sun, 19 Jul 2020 15:38:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hmQRpfGh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726499AbgGSWfB (ORCPT + 99 others); Sun, 19 Jul 2020 18:35:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726126AbgGSWfB (ORCPT ); Sun, 19 Jul 2020 18:35:01 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1845C0619D2 for ; Sun, 19 Jul 2020 15:35:00 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id 22so20519088wmg.1 for ; Sun, 19 Jul 2020 15:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FvG5reSg9l5TH3VxmyNLzPs9V51oowG1ILpSonp6Wuc=; b=hmQRpfGhT4g6DyQGsFoQajY/vzYf6RKQrdBPuO9FIqTdOKauhSU6f4jHSKK2yintMf smkkdJCjcJBOCWx/+k7lrJd7+gnpnkXjFxZXgX5yMRrYF/O4mBo9Sw9tZCvJoEBsohNz excaibX1qmF6QsbEPdTj99swAic2anaKMsVKCvw7eKTlyoOMcKsVGxvKxmRoQEUacBIk CMgsDyxx8Nqh+lnvmtaMqBmqFt+qbiXN4KQCSobKy2yQWZngPiP+4zA3Yjm45DA2YrFD LagSmh1Ac8zh96S0dlybtD38LAhlHQOXA+MU5Wof9rhzy7apJma3ZXKK9ut7i7uvoAA7 1gZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FvG5reSg9l5TH3VxmyNLzPs9V51oowG1ILpSonp6Wuc=; b=c+/HiEogScJw0qMz2Eq6m6tGfGBmGg/rieCu3DGjJqp9vth6+DGY4GBXXGocCFg2lP YrefK9Rlrin3S1nVoNeAk8MPlVDH/wkRAQGikjgPguPhKXaNfwCdnQ0jOJ8hZ6tMXlie lWw9bXZKzzo9xBl0TRVt1Bmd0IgblnrJ8JYCxZG9A5VgGCT7OiEH3et6JpudGwLAzgVu aHb19ex58T7DGoLtmpVrI68h44TiqAArrnkWvQhYSiL8fwfqjAFujFbrCt6l2CfH8qxN TU+1MfpTBTK6gg6pasERAy8wko4Yt86mcHOx3QgjWipIkvZh34Pse7azNSVgKh3UiARh 31GQ== X-Gm-Message-State: AOAM533NhXoeYuXP750VHt2/vglUx0WnhAHsCcrGfZkjDtR7sOEJFPZN AbemnLU7s2u/5oaCaNTjUY/3Cd4PYhBS9aTjiJznAg== X-Received: by 2002:a1c:398b:: with SMTP id g133mr18309800wma.76.1595198099383; Sun, 19 Jul 2020 15:34:59 -0700 (PDT) MIME-Version: 1.0 References: <20200719181320.785305-1-jolsa@kernel.org> <20200719181320.785305-13-jolsa@kernel.org> In-Reply-To: <20200719181320.785305-13-jolsa@kernel.org> From: Ian Rogers Date: Sun, 19 Jul 2020 15:34:48 -0700 Message-ID: Subject: Re: [PATCH 12/19] perf metric: Add events for the current list To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Andi Kleen , Kajol Jain , John Garry , "Paul A. Clarke" , Stephane Eranian Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 19, 2020 at 11:14 AM Jiri Olsa wrote: > > There's no need to iterate the whole list of groups, > when adding new events. The currently created groups > are the ones we want to add. > > Signed-off-by: Jiri Olsa Acked-by: Ian Rogers Thanks, Ian > --- > tools/perf/util/metricgroup.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c > index bb5757b9419d..332414d93f7a 100644 > --- a/tools/perf/util/metricgroup.c > +++ b/tools/perf/util/metricgroup.c > @@ -813,6 +813,7 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group, > { > struct pmu_event *pe; > struct egroup *eg; > + LIST_HEAD(list); > int i, ret; > bool has_match = false; > > @@ -820,7 +821,7 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group, > has_match = true; > eg = NULL; > > - ret = add_metric(group_list, pe, metric_no_group, &eg); > + ret = add_metric(&list, pe, metric_no_group, &eg); > if (ret) > return ret; > > @@ -829,7 +830,7 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group, > * included in the expression. > */ > ret = resolve_metric(eg, metric_no_group, > - group_list, map); > + &list, map); > if (ret) > return ret; > } > @@ -838,7 +839,7 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group, > if (!has_match) > return -EINVAL; > > - list_for_each_entry(eg, group_list, nd) { > + list_for_each_entry(eg, &list, nd) { > if (events->len > 0) > strbuf_addf(events, ","); > > @@ -850,6 +851,8 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group, > &eg->pctx); > } > } > + > + list_splice(&list, group_list); > return 0; > } > > -- > 2.25.4 >