Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1842180ybv; Thu, 6 Feb 2020 10:46:59 -0800 (PST) X-Google-Smtp-Source: APXvYqwrBRUaAJMNme8B3c/u10BG+fpf5CGOoxjUzdZFt/zhMFKP0EDtjwUvLRrHrApAvWLG8bFr X-Received: by 2002:a9d:7f81:: with SMTP id t1mr29523517otp.95.1581014819764; Thu, 06 Feb 2020 10:46:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581014819; cv=none; d=google.com; s=arc-20160816; b=PCXPCdz3RUNJWqhRJvTdNjczp4iM0aHfWdib4v+plUaKuVaVA+O8OUvcJe60lmJu5f fDSP4XGU/XzqWKpxtzEAJ5bY625NktoxSc+14sUZ4Toidb3lb7JdrC1LgdGeCEnWDd2m 2JrWz48mNegkJQn27iYgjB6eWSg9U85/X9NEp7flXk5k11McarqfN8OdF5gKmNsMKiGx 4ZSjSkjzBo9Vg9tzVBHX2yTjrxFIPJq7vAlWcy2iDqD7MksVEuyZVo+wmc76QpKNyZXn AuoBhF/Ex/HBaXUmkWiHzk5wLs5Y9sURbr/Ufgm7Os9/KYNI+zFDGyu8Fx8RKcYRj6Jn pgcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=TTShU17dPXmvecG0o1LJevam/FulFoOxzucu7Hkvbno=; b=F7eQ3x0i0lJ+aL94Pg+GjV6prajxx6QtlSru2p6UYpGDnWCLdmgy4Hp0YEZmKRt149 Wu9hUhfh8sXIUzHxrdiHKoiYWC7mM3CZ2py9Ex1VZUwiMpeGGFdibi1RFJ/f5VEQ5cYg g1URrkyrUkCsWZ76GhkWNaYqUjzC7Nx1jz0TUCf27Jjmrf9IHYgW07hsurxFT23NVaxP 4+bY9CPThkeQ8RbSv4Qgg7mkp0qPeXEP45Bm19m//3uol5LQS7nZrXCUcazVRvbBll/P +DpitlF7E8rg/29VBWaOug+Wh0Dl7EvcrTQy6NgUAAB/JVW1uXHKciTUVG9jWDrsaRl+ 8tKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="PZ2/DfLs"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si219740otn.216.2020.02.06.10.46.47; Thu, 06 Feb 2020 10:46:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="PZ2/DfLs"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727788AbgBFSpb (ORCPT + 99 others); Thu, 6 Feb 2020 13:45:31 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:25989 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726990AbgBFSpb (ORCPT ); Thu, 6 Feb 2020 13:45:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581014730; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TTShU17dPXmvecG0o1LJevam/FulFoOxzucu7Hkvbno=; b=PZ2/DfLs5ljDzuVgor5ydzBc462a9AC+/ejxcvwx0Go7nXk3pxwflP9WLt5POFvt3OgRAp GjOKKpthtW/OwqksWAlNtcfhSeL4N9uwZ0Nv7S0+t0Dm0SIp2RbVVugf5CEu1jdYNrRpdq jBcfQTAHWtfjMTihQ0BNbbnGk3bQFrU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-349-uuWUjgWwMtCMuAwlXdnwzA-1; Thu, 06 Feb 2020 13:45:22 -0500 X-MC-Unique: uuWUjgWwMtCMuAwlXdnwzA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6258C1088390; Thu, 6 Feb 2020 18:45:19 +0000 (UTC) Received: from krava (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA9C7790CF; Thu, 6 Feb 2020 18:45:14 +0000 (UTC) Date: Thu, 6 Feb 2020 19:45:10 +0100 From: Jiri Olsa To: Kajol Jain Cc: acme@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Jiri Olsa , Alexander Shishkin , Andi Kleen , Kan Liang , Peter Zijlstra , Jin Yao , Madhavan Srinivasan , Anju T Sudhakar , Ravi Bangoria Subject: Re: [PATCH v3] tools/perf/metricgroup: Fix printing event names of metric group with multiple events incase of overlapping events Message-ID: <20200206184510.GA1669706@krava> References: <20200131052522.7267-1-kjain@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200131052522.7267-1-kjain@linux.ibm.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 31, 2020 at 10:55:22AM +0530, Kajol Jain wrote: SNIP > ev->metric_leader = metric_events[i]; > } > + j++; > } > + ev = metric_events[i]; > + evlist_used[ev->idx] = true; > } > > return metric_events[0]; > @@ -160,6 +161,9 @@ static int metricgroup__setup_events(struct list_head *groups, > int ret = 0; > struct egroup *eg; > struct evsel *evsel; > + bool evlist_used[perf_evlist->core.nr_entries]; > + > + memset(evlist_used, 0, perf_evlist->core.nr_entries); I know I posted this in the previous email, but are we sure bool is always 1 byte? would sizeod(evlist_used) be safer? other than that it looks ok Andi, you're ok with this? thanks, jirka > > list_for_each_entry (eg, groups, nd) { > struct evsel **metric_events; > @@ -170,7 +174,7 @@ static int metricgroup__setup_events(struct list_head *groups, > break; > } > evsel = find_evsel_group(perf_evlist, eg->ids, eg->idnum, > - metric_events); > + metric_events, evlist_used); > if (!evsel) { > pr_debug("Cannot resolve %s: %s\n", > eg->metric_name, eg->metric_expr); > -- > 2.21.0 >