[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160302115750.GA28054@krava.redhat.com>
Date: Wed, 2 Mar 2016 12:57:50 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: acme@...nel.org, jolsa@...nel.org, linux-kernel@...r.kernel.org,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 5/7] perf, tools, stat: Implement --metric-only mode
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
Powered by blists - more mailing lists