diff options
author | Ingo Molnar <mingo@kernel.org> | 2013-10-08 13:51:31 +0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-10-08 13:51:31 +0400 |
commit | 429eb051011a580beae2dc9f8caed5dade9591dc (patch) | |
tree | b777c5d032e34c634aa19bf9fc0833390b37d7f1 /tools/perf/util/header.c | |
parent | b7af41a1bc255c0098c37a4bcf5c7e5e168ce875 (diff) | |
parent | 1651d120baddf68846188bcdf0ef5350068436cf (diff) | |
download | linux-429eb051011a580beae2dc9f8caed5dade9591dc.tar.xz |
Merge branch 'perf/urgent' into tools/perf/build
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r-- | tools/perf/util/header.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index ce69901176d8..c3e5a3b817ab 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -2768,6 +2768,18 @@ int perf_session__read_header(struct perf_session *session) if (perf_file_header__read(&f_header, header, fd) < 0) return -EINVAL; + /* + * Sanity check that perf.data was written cleanly; data size is + * initialized to 0 and updated only if the on_exit function is run. + * If data size is still 0 then the file contains only partial + * information. Just warn user and process it as much as it can. + */ + if (f_header.data.size == 0) { + pr_warning("WARNING: The %s file's data size field is 0 which is unexpected.\n" + "Was the 'perf record' command properly terminated?\n", + session->filename); + } + nr_attrs = f_header.attrs.size / f_header.attr_size; lseek(fd, f_header.attrs.offset, SEEK_SET); |