Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1355159
| From | Andi Kleen <andi@firstfloor.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] perf, tools, stat: Print warning when no metric with --metric-only |
| Date | 2016-03-10 15:30 +0100 |
| Message-ID | <rb9Ld-89a-27@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
tools/perf/builtin-stat.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 1f19f2f..70efb58 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -743,6 +743,7 @@ struct outstate {
int nfields;
int id, nr;
struct perf_evsel *evsel;
+ int nheaders;
};
#define METRIC_LEN 35
@@ -919,6 +920,7 @@ static void print_metric_header(void *ctx, const char *color __maybe_unused,
fprintf(os->fh, "%s%s", unit, csv_sep);
else
fprintf(os->fh, "%-*s ", METRIC_ONLY_LEN, unit);
+ os->nheaders++;
}
static void nsec_printout(int id, int nr, struct perf_evsel *evsel, double avg)
@@ -1315,6 +1317,8 @@ static void print_metric_headers(char *prefix)
&out);
}
fputc('\n', stat_config.output);
+ if (os.nheaders == 0)
+ pr_warning("No metrics defined by configured events\n");
}
static void print_interval(char *prefix, struct timespec *ts)
--
2.5.0
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] perf, tools, stat: Print warning when no metric with --metric-only Andi Kleen <andi@firstfloor.org> - 2016-03-10 15:30 +0100
Re: [PATCH] perf, tools, stat: Print warning when no metric with --metric-only Jiri Olsa <jolsa@redhat.com> - 2016-03-11 09:10 +0100
Re: [PATCH] perf, tools, stat: Print warning when no metric with --metric-only Andi Kleen <andi@firstfloor.org> - 2016-03-12 00:10 +0100
csiph-web