Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Jiri 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.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
45112e89 c60f83b8

+5 -6
+2 -3
tools/perf/builtin-record.c
··· 660 660 661 661 static int process_buildids(struct record *rec) 662 662 { 663 - struct perf_data *data = &rec->data; 664 663 struct perf_session *session = rec->session; 665 664 666 - if (data->size == 0) 665 + if (perf_data__size(&rec->data) == 0) 667 666 return 0; 668 667 669 668 /* ··· 850 851 return; 851 852 852 853 rec->session->header.data_size += rec->bytes_written; 853 - data->size = lseek(perf_data__fd(data), 0, SEEK_CUR); 854 + data->file.size = lseek(perf_data__fd(data), 0, SEEK_CUR); 854 855 855 856 if (!rec->no_buildid) { 856 857 process_buildids(rec);
+1 -1
tools/perf/util/data.c
··· 82 82 goto out_close; 83 83 } 84 84 85 - data->size = st.st_size; 85 + data->file.size = st.st_size; 86 86 return fd; 87 87 88 88 out_close:
+2 -2
tools/perf/util/data.h
··· 12 12 struct perf_data_file { 13 13 const char *path; 14 14 int fd; 15 + unsigned long size; 15 16 }; 16 17 17 18 struct perf_data { 18 19 struct perf_data_file file; 19 20 bool is_pipe; 20 21 bool force; 21 - unsigned long size; 22 22 enum perf_data_mode mode; 23 23 }; 24 24 ··· 44 44 45 45 static inline unsigned long perf_data__size(struct perf_data *data) 46 46 { 47 - return data->size; 47 + return data->file.size; 48 48 } 49 49 50 50 int perf_data__open(struct perf_data *data);