From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933700AbbFWWDZ (ORCPT ); Tue, 23 Jun 2015 18:03:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43141 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752298AbbFWWDS (ORCPT ); Tue, 23 Jun 2015 18:03:18 -0400 Date: Wed, 24 Jun 2015 00:03:12 +0200 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , lkml , Adrian Hunter , Andi Kleen , David Ahern , Ingo Molnar , Namhyung Kim , Peter Zijlstra , Stephane Eranian Subject: Re: [PATCH 09/27] perf stat: Introduce perf_counts function Message-ID: <20150623220312.GC24969@krava.brq.redhat.com> References: <1435012588-9007-1-git-send-email-jolsa@kernel.org> <1435012588-9007-10-git-send-email-jolsa@kernel.org> <20150623211154.GC11231@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150623211154.GC11231@kernel.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 23, 2015 at 06:11:54PM -0300, Arnaldo Carvalho de Melo wrote: > Em Tue, Jun 23, 2015 at 12:36:10AM +0200, Jiri Olsa escreveu: > > Introducing perf_counts function, that returns > > 'struct perf_counts_values' pointer for given cpu. > > - evsel->counts->cpu[cpu] = *count; > > + *perf_counts(evsel->counts, cpu) = *count; > > For consistency, just like thread_map__set_pid(), please have a: it's consistent with xyarray__entry > > perf_counts__set(evsel->counts, *cont); > > In addition to its counterpart: > > perf_counts__value(evsel->counts, cpu); > > Since you're not storing multiple entries per bucket, we need to use the > "value" idiom. perf_counts returns pointer to the 'struct perf_counts_values' which is clean and valid and IMO the code is more readable You use just 'perf_counts(counts, cpu, thread)' and get values and do whatever you want with them.. why introduce 2 functions for it? thanks, jirka