[tip:perf/core] perf report: Display perf.data header info

From: tip-bot for Jiri Olsa
Date: Fri Mar 09 2018 - 03:52:53 EST


Commit-ID: e971a5a8399a5e84164239a5c2d59b8a51314241
Gitweb: https://git.kernel.org/tip/e971a5a8399a5e84164239a5c2d59b8a51314241
Author: Jiri Olsa <jolsa@xxxxxxxxxx>
AuthorDate: Wed, 7 Mar 2018 16:50:03 +0100
Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitDate: Thu, 8 Mar 2018 11:30:41 -0300

perf report: Display perf.data header info

Display more header info from perf.data file, following values:

$ perf report -i perf.data --header-only
...
# header version : 1
# data offset : 424
# data size : 3364280
# feat offset : 3364704

It's handy for debuging.

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Tested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Link: http://lkml.kernel.org/r/20180307155020.32613-3-jolsa@xxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/header.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index a326e0d8b5b6..e0c3cad0fd8d 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2318,7 +2318,12 @@ int perf_header__fprintf_info(struct perf_session *session, FILE *fp, bool full)
if (ret == -1)
return -1;

- fprintf(fp, "# captured on: %s", ctime(&st.st_ctime));
+ fprintf(fp, "# captured on : %s", ctime(&st.st_ctime));
+
+ fprintf(fp, "# header version : %u\n", header->version);
+ fprintf(fp, "# data offset : %" PRIu64 "\n", header->data_offset);
+ fprintf(fp, "# data size : %" PRIu64 "\n", header->data_size);
+ fprintf(fp, "# feat offset : %" PRIu64 "\n", header->feat_offset);

perf_header__process_sections(header, fd, &hd,
perf_file_section__fprintf_info);