diff options
author | Ingo Molnar <mingo@kernel.org> | 2013-10-08 07:29:09 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-10-08 07:29:09 +0200 |
commit | 1651d120baddf68846188bcdf0ef5350068436cf (patch) | |
tree | 9316fed404c26d55ae87ae6b68b4842e78c820b9 /tools/perf/util/header.c | |
parent | d8b11a0cbd1c66ce283eb9dabe0498dfa6483f32 (diff) | |
parent | b314e5cfd11fd78545ce6c2be42646254390c1aa (diff) |
Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
* The libaudit test was failing in some systems due to a unescaped newline, fix
it so that the 'trace' tool can be built in such systems.
* Fix installation of libexec components.
* Add default handler for mmap2 events so that tools that don't explicitely
define an MMAP2 handler don't crash, fix from David Ahern.
* Fix to find line information for probe list, from Masami Hiramatsu.
* Set child_pid after perf_evlist__prepare_workload(), fix from Namhyung Kim.
* Fix infinite loop on invalid perf.data file, from Namhyung Kim.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
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 ce69901176d..c3e5a3b817a 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); |