From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932616AbdBHLba (ORCPT ); Wed, 8 Feb 2017 06:31:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51228 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932479AbdBHLb2 (ORCPT ); Wed, 8 Feb 2017 06:31:28 -0500 Date: Wed, 8 Feb 2017 12:31:21 +0100 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH 06/10] perf, tools: Collapse identically named events in perf stat Message-ID: <20170208113121.GC10639@krava> References: <20170128020345.19007-1-andi@firstfloor.org> <20170128020345.19007-7-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170128020345.19007-7-andi@firstfloor.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 08 Feb 2017 11:31:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 27, 2017 at 06:03:41PM -0800, Andi Kleen wrote: SNIP > +static void collect_all_aliases(struct perf_evsel *counter, > + void (*cb)(struct perf_evsel *counter, void *data, > + bool first), > + void *data) > +{ > + struct perf_evsel *alias; > + > + alias = list_prepare_entry(counter, &(evsel_list->entries), node); > + list_for_each_entry_continue (alias, &evsel_list->entries, node) { > + if (strcmp(perf_evsel__name(alias), perf_evsel__name(counter)) || > + alias->scale != counter->scale || > + alias->cgrp != counter->cgrp || > + strcmp(alias->unit, counter->unit) || > + nsec_counter(alias) != nsec_counter(counter)) > + break; > + alias->merged_stat = true; > + cb(alias, data, false); > + } > +} > + > +static void collect_aliases(struct perf_evsel *counter, > + void (*cb)(struct perf_evsel *counter, void *data, > + bool first), > + void *data) > +{ > + cb(counter, data, true); > + if (!no_merge) > + collect_all_aliases(counter, cb, data); > +} could you please split this into 2 changes: - adding adding collect_aliases function with no functional change just changing all the print callers to use it - adding collect_all_aliases change that actualy change the behaviour and merges the stats also please change the collect_aliases name to something generic like collect data thanks, jirka