Commit 45112e89 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf data: Move size to struct perf_data_file

We are about to add support for multiple files, so we need each file to
keep its size.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20190221094145.9151-2-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c60f83b8
...@@ -660,10 +660,9 @@ static int process_sample_event(struct perf_tool *tool, ...@@ -660,10 +660,9 @@ static int process_sample_event(struct perf_tool *tool,
static int process_buildids(struct record *rec) static int process_buildids(struct record *rec)
{ {
struct perf_data *data = &rec->data;
struct perf_session *session = rec->session; struct perf_session *session = rec->session;
if (data->size == 0) if (perf_data__size(&rec->data) == 0)
return 0; return 0;
/* /*
...@@ -851,7 +850,7 @@ record__finish_output(struct record *rec) ...@@ -851,7 +850,7 @@ record__finish_output(struct record *rec)
return; return;
rec->session->header.data_size += rec->bytes_written; rec->session->header.data_size += rec->bytes_written;
data->size = lseek(perf_data__fd(data), 0, SEEK_CUR); data->file.size = lseek(perf_data__fd(data), 0, SEEK_CUR);
if (!rec->no_buildid) { if (!rec->no_buildid) {
process_buildids(rec); process_buildids(rec);
......
...@@ -82,7 +82,7 @@ static int open_file_read(struct perf_data *data) ...@@ -82,7 +82,7 @@ static int open_file_read(struct perf_data *data)
goto out_close; goto out_close;
} }
data->size = st.st_size; data->file.size = st.st_size;
return fd; return fd;
out_close: out_close:
......
...@@ -12,13 +12,13 @@ enum perf_data_mode { ...@@ -12,13 +12,13 @@ enum perf_data_mode {
struct perf_data_file { struct perf_data_file {
const char *path; const char *path;
int fd; int fd;
unsigned long size;
}; };
struct perf_data { struct perf_data {
struct perf_data_file file; struct perf_data_file file;
bool is_pipe; bool is_pipe;
bool force; bool force;
unsigned long size;
enum perf_data_mode mode; enum perf_data_mode mode;
}; };
...@@ -44,7 +44,7 @@ static inline int perf_data__fd(struct perf_data *data) ...@@ -44,7 +44,7 @@ static inline int perf_data__fd(struct perf_data *data)
static inline unsigned long perf_data__size(struct perf_data *data) static inline unsigned long perf_data__size(struct perf_data *data)
{ {
return data->size; return data->file.size;
} }
int perf_data__open(struct perf_data *data); int perf_data__open(struct perf_data *data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment