From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755151AbcCBL5z (ORCPT ); Wed, 2 Mar 2016 06:57:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56301 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751609AbcCBL5y (ORCPT ); Wed, 2 Mar 2016 06:57:54 -0500 Date: Wed, 2 Mar 2016 12:57:50 +0100 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH 5/7] perf, tools, stat: Implement --metric-only mode Message-ID: <20160302115750.GA28054@krava.redhat.com> References: <1456858672-21594-1-git-send-email-andi@firstfloor.org> <1456858672-21594-6-git-send-email-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1456858672-21594-6-git-send-email-andi@firstfloor.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 02 Mar 2016 11:57:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 01, 2016 at 10:57:50AM -0800, Andi Kleen wrote: SNIP > static void print_interval(char *prefix, struct timespec *ts) > { > FILE *output = stat_config.output; > @@ -1130,7 +1287,7 @@ static void print_interval(char *prefix, struct timespec *ts) > > sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, csv_sep); > > - if (num_print_interval == 0 && !csv_output) { > + if (num_print_interval == 0 && !csv_output && !metric_only) { > switch (stat_config.aggr_mode) { > case AGGR_SOCKET: > fprintf(output, "# time socket cpus counts %*s events\n", unit_width, "unit"); > @@ -1217,6 +1374,17 @@ static void print_counters(struct timespec *ts, int argc, const char **argv) > else > print_header(argc, argv); > > + if (metric_only) { > + static int num_print_iv; > + > + if (num_print_iv == 0) > + print_metric_headers(prefix); > + if (num_print_iv++ == 25) > + num_print_iv = 0; > + if (stat_config.aggr_mode == AGGR_GLOBAL && prefix) > + fprintf(stat_config.output, "%s", prefix); > + } > + > switch (stat_config.aggr_mode) { > case AGGR_CORE: > case AGGR_SOCKET: > @@ -1229,6 +1397,8 @@ static void print_counters(struct timespec *ts, int argc, const char **argv) > case AGGR_GLOBAL: > evlist__for_each(evsel_list, counter) > print_counter_aggr(counter, prefix); > + if (metric_only) > + fputc('\n', stat_config.output); this new line printing based on metric_only is all over the place.. could we sorted out new lines in the print callbacks? this makes my head hurt ;-) also some comments would be great thanks, jirka