From: Jiri Olsa <jolsa@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH] perf, tools, stat: Print warning when no metric with --metric-only
Date: Fri, 11 Mar 2016 09:06:34 +0100 [thread overview]
Message-ID: <20160311080634.GA1052@krava.redhat.com> (raw)
In-Reply-To: <1457620037-2978-1-git-send-email-andi@firstfloor.org>
On Thu, Mar 10, 2016 at 06:27:17AM -0800, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> Print a warning when --metric-only is specified, but the events
> define no metric. Requested by Jiri.
>
> % perf stat -e cycles --metric-only true
>
> Performance counter stats for 'true':
>
> No metrics defined by configured events
>
> 0.001612070 seconds time elapsed
>
how about printing the 'time' column and keeping the warning on the header line?
[jolsa@krava perf]$ sudo ./perf stat -a -I 1000 --metric-only
time insn per cycle branch-misses of all branches
1.000370422 0.30 6.77%
2.000749536 0.40 5.75%
3.001007542 0.28 5.38%
4.001324779 0.57 5.83%
^C 4.011558899 0.01 0.12%
[jolsa@krava perf]$ sudo ./perf stat -a -I 1000 --metric-only -e cycles
time No metrics defined by configured events
1.000211156
2.000432519
thanks,
jirka
---
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 91188047be6a..9ce4138a8065 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1302,7 +1302,7 @@ static void print_metric_headers(char *prefix)
};
if (prefix)
- fprintf(stat_config.output, "%s", prefix);
+ fprintf(stat_config.output, "%16s ", "time");
if (!csv_output)
fprintf(stat_config.output, "%*s",
@@ -1319,9 +1319,9 @@ static void print_metric_headers(char *prefix)
0,
&out);
}
- fputc('\n', stat_config.output);
if (os.nheaders == 0)
- pr_warning("No metrics defined by configured events\n");
+ pr_warning("No metrics defined by configured events");
+ fputc('\n', stat_config.output);
}
static void print_interval(char *prefix, struct timespec *ts)
next prev parent reply other threads:[~2016-03-11 8:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-10 14:27 [PATCH] perf, tools, stat: Print warning when no metric with --metric-only Andi Kleen
2016-03-11 8:06 ` Jiri Olsa [this message]
2016-03-11 23:04 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160311080634.GA1052@krava.redhat.com \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox