diff options
author | Namhyung Kim <[email protected]> | 2015-01-29 17:02:01 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2015-01-29 17:02:01 -0300 |
commit | c52686f9f888d23ca72f1309e86af8e91d075697 (patch) | |
tree | 7098b1f13486d538e522191c577c632d3c6cb37e | |
parent | 42aa276f40730211383e9a9923416f1fb9841d68 (diff) |
perf symbols: Convert lseek + read to pread
When dso_cache__read() is called, it reads data from the given offset
using lseek + normal read syscall. It can be combined to a single pread
syscall.
Signed-off-by: Namhyung Kim <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
[ Fixed it up when cherry picking it from the multi threaded patchkit ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r-- | tools/perf/util/dso.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 45be944d450a..c2f7d3b90966 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -532,12 +532,8 @@ dso_cache__read(struct dso *dso, u64 offset, u8 *data, ssize_t size) break; cache_offset = offset & DSO__DATA_CACHE_MASK; - ret = -EINVAL; - if (-1 == lseek(dso->data.fd, cache_offset, SEEK_SET)) - break; - - ret = read(dso->data.fd, cache->data, DSO__DATA_CACHE_SIZE); + ret = pread(dso->data.fd, cache->data, DSO__DATA_CACHE_SIZE, cache_offset); if (ret <= 0) break; |