提交 c51fd639 编写于 作者: A Andi Kleen 提交者: Arnaldo Carvalho de Melo

perf stat: Add missing aggregation headers for --metric-only CSV

When in CSV mode --metric-only outputs an header, unlike the other
modes. Previously it did not properly print headers for the aggregation
columns, so the headers were actually shifted against the real values.

Fix this here by outputting the correct headers for CSV.

v2: Indent array.
Signed-off-by: NAndi Kleen <ak@linux.intel.com>
Acked-by: NJiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/1464119559-17203-4-git-send-email-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 41c8ca2a
...@@ -1316,6 +1316,14 @@ static int aggr_header_lens[] = { ...@@ -1316,6 +1316,14 @@ static int aggr_header_lens[] = {
[AGGR_GLOBAL] = 0, [AGGR_GLOBAL] = 0,
}; };
static const char *aggr_header_csv[] = {
[AGGR_CORE] = "core,cpus,",
[AGGR_SOCKET] = "socket,cpus",
[AGGR_NONE] = "cpu,",
[AGGR_THREAD] = "comm-pid,",
[AGGR_GLOBAL] = ""
};
static void print_metric_headers(const char *prefix, bool no_indent) static void print_metric_headers(const char *prefix, bool no_indent)
{ {
struct perf_stat_output_ctx out; struct perf_stat_output_ctx out;
...@@ -1330,6 +1338,12 @@ static void print_metric_headers(const char *prefix, bool no_indent) ...@@ -1330,6 +1338,12 @@ static void print_metric_headers(const char *prefix, bool no_indent)
if (!csv_output && !no_indent) if (!csv_output && !no_indent)
fprintf(stat_config.output, "%*s", fprintf(stat_config.output, "%*s",
aggr_header_lens[stat_config.aggr_mode], ""); aggr_header_lens[stat_config.aggr_mode], "");
if (csv_output) {
if (stat_config.interval)
fputs("time,", stat_config.output);
fputs(aggr_header_csv[stat_config.aggr_mode],
stat_config.output);
}
/* Print metrics headers only */ /* Print metrics headers only */
evlist__for_each(evsel_list, counter) { evlist__for_each(evsel_list, counter) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册