lkml.org 
[lkml]   [2016]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2016-03-02 13:41    [W:0.111 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site