From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2992651AbbHHRkh (ORCPT ); Sat, 8 Aug 2015 13:40:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54836 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2992474AbbHHRke (ORCPT ); Sat, 8 Aug 2015 13:40:34 -0400 Date: Sat, 8 Aug 2015 19:40:32 +0200 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, eranian@google.com, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH 2/4] perf, tools, stat: Abstract stat metrics printing Message-ID: <20150808174032.GF17040@krava.brq.redhat.com> References: <1438215700-5530-1-git-send-email-andi@firstfloor.org> <1438215700-5530-3-git-send-email-andi@firstfloor.org> <20150730134755.GP9606@krava.brq.redhat.com> <20150804004111.GV1747@two.firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150804004111.GV1747@two.firstfloor.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, Aug 04, 2015 at 02:41:11AM +0200, Andi Kleen wrote: > > > > because we already need to make the print_metric callback global, > > would it be better to make this struct global, having all the > > needed callbacks defined within? something like: > > It's actually not global, but static. > > I skipped this change. After some other changes there is only > a single function call with these arguments left, so it's not > an issue to pass it around. hum, I dont understand.. I can se the same code in the new version: +typedef void (*print_metric_t)(void *ctx, const char *color, const char *unit, + const char *fmt, double val); + void perf_stat__reset_shadow_stats(void); void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count, int cpu); -void perf_stat__print_shadow_stats(FILE *out, struct perf_evsel *evsel, - double avg, int cpu, enum aggr_mode aggr); +void perf_stat__print_shadow_stats(struct perf_evsel *evsel, + double avg, int cpu, + print_metric_t print_metric, + void (*new_line)(void *ctx), + void *ctx); both: print_metric_t print_metric void (*new_line)(void *ctx) are still there.. what single function call did you mean? jirka