aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2010-02-02 22:53:14 -0500
committerIngo Molnar <mingo@elte.hu>2010-02-03 03:03:59 -0500
commitb8f46c5a34fa64fd456295388d18f50ae69d9f37 (patch)
treecba5da0bb3e4ca5c450df8aaa53fc74945c6fd28 /tools/perf/util/session.c
parent59f411b62c9282891274e721fea29026b0eda3cc (diff)
perf tools: Use O_LARGEFILE to open perf data file
Open perf data file with O_LARGEFILE flag since its size is easily larger that 2G. For example: # rm -rf perf.data # ./perf kmem record sleep 300 [ perf record: Woken up 0 times to write data ] [ perf record: Captured and wrote 3142.147 MB perf.data (~137282513 samples) ] # ll -h perf.data -rw------- 1 root root 3.1G ..... Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <4B68F32A.9040203@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 8e7c1896eaa2..cf91d099f0aa 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1,3 +1,6 @@
1#define _LARGEFILE64_SOURCE
2#define _FILE_OFFSET_BITS 64
3
1#include <linux/kernel.h> 4#include <linux/kernel.h>
2 5
3#include <byteswap.h> 6#include <byteswap.h>
@@ -12,7 +15,7 @@ static int perf_session__open(struct perf_session *self, bool force)
12{ 15{
13 struct stat input_stat; 16 struct stat input_stat;
14 17
15 self->fd = open(self->filename, O_RDONLY); 18 self->fd = open(self->filename, O_RDONLY|O_LARGEFILE);
16 if (self->fd < 0) { 19 if (self->fd < 0) {
17 pr_err("failed to open file: %s", self->filename); 20 pr_err("failed to open file: %s", self->filename);
18 if (!strcmp(self->filename, "perf.data")) 21 if (!strcmp(self->filename, "perf.data"))