Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3660757ybv; Mon, 10 Feb 2020 04:13:05 -0800 (PST) X-Google-Smtp-Source: APXvYqwzZbrAl0ct+RJlXzjskFnmpgmSS5EmHS5DdUWrDpjL6kDoDcR/O2pMyexCGF1EAzLtHvrL X-Received: by 2002:a9d:6f11:: with SMTP id n17mr821265otq.126.1581336785087; Mon, 10 Feb 2020 04:13:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581336785; cv=none; d=google.com; s=arc-20160816; b=HnpqM5lti8ernI8JD8wv79fLOZz4g5JXEfHOaY5nU19aP+h1jg8p9ZzdRLXubv9Nm7 naNmJ9i+mbvKeVjyFt3b43ZVhfcTEm/fy0sF4bXSjg4UaUdyZqkAKspfUqrKIXdUU8t9 hF1gjMFNhqd4Z6dtvKpzhgpoZtUf9aIVh1f0ogN+mDCiCWkZOk2J8gb9UorjFFhMYEYT MSfJzfqjGNrpYyzioVADWzPwSj/h5RL3ay/ZZ8as/NP9VvVZYNqam4DDaj+575uBAUbT vRM58CY0wjGOcLhHiBqt3oYAYMc2tJAyMWyOWdgFNOmdjrDN6xsHlWfEKD/u4OQJGQ+p W6OQ== 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=KToqo3vgNyBHRDRhobK+A4mQ66+OslNDKm9gvh/dCYw=; b=SpF6S+Uaxq4A16TjDc3Z15NV1Ha0eOGBRyfad7gwzk2JPVhk1am2EB3ylwzc6xCWU1 CZivJbvQzBA/AKaX71PvBr9yw+9tp9iQSI6lt86if6M2M4PQSYAlYxdtsaJ4mh9gvtsI 8M4uS1TWmnAWl9/vDk4C94tJAs1R0NSaxDGVWrc9Vg4fCf6uwzlSHGkuqDgXB95xgM+0 kJFXpDICZ+s+0fQp/Izol7dmJGtBNwe5TmzzfaQSS5eJAaVpvy6NDIv+mnmcinSdQ61q mAzE0oD8+S4TEXGgdd3tt2loWJguIDXIxCc25fggFKLhYBEBvvLptNkplwhuxpSxEHT6 DDmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Db62e2zy; 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 u14si126220otg.10.2020.02.10.04.12.52; Mon, 10 Feb 2020 04:13:05 -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=Db62e2zy; 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 S1727640AbgBJMLs (ORCPT + 99 others); Mon, 10 Feb 2020 07:11:48 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:44846 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727505AbgBJMLr (ORCPT ); Mon, 10 Feb 2020 07:11:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581336706; 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=KToqo3vgNyBHRDRhobK+A4mQ66+OslNDKm9gvh/dCYw=; b=Db62e2zyKpPLEGG7dHQf3ux55c32jKlMMbnuFH54ldtEk//dGzCDhmn4lBfgHYvxyWbxqq c08lKsKXjdRPltpJjZKKnILT18YUK8lHctI8JbXOnVwSmNFbUv6+hEuU97bTfJZ/qeCq3s V3ECJZxD77tkKl/OkkfGs3XFXRxvEOU= 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-2-0of35acdM86UPjtdqnRHuw-1; Mon, 10 Feb 2020 07:11:42 -0500 X-MC-Unique: 0of35acdM86UPjtdqnRHuw-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 AD610800D48; Mon, 10 Feb 2020 12:11:40 +0000 (UTC) Received: from krava (unknown [10.43.17.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1177287058; Mon, 10 Feb 2020 12:11:37 +0000 (UTC) Date: Mon, 10 Feb 2020 13:11:35 +0100 From: Jiri Olsa To: Joe Perches Cc: Kajol Jain , 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: <20200210121135.GI1907700@krava> References: <20200131052522.7267-1-kjain@linux.ibm.com> <20200206184510.GA1669706@krava> <51a4b570eb47e80801a460c89acf20d13a269600.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51a4b570eb47e80801a460c89acf20d13a269600.camel@perches.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 Thu, Feb 06, 2020 at 10:58:12AM -0800, Joe Perches wrote: > On Thu, 2020-02-06 at 19:45 +0100, Jiri Olsa wrote: > > 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? > > stack declarations of variable length arrays are not > a good thing. > > https://lwn.net/Articles/749089/ > > and > > bool evlist_used[perf_evlist->core.nr_entries] = {}; hum, I think we already have few of them in perf ;-) thanks for the link right, that initialization is of course much better, thanks jirka