Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1346120

[PATCH 10/11] perf record: Introduce record__finish_output() to finish a perf.data

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 10/11] perf record: Introduce record__finish_output() to finish a perf.data
Date 2016-02-29 20:30 +0100
Message-ID <r7BG2-7d5-27@gated-at.bofh.it> (permalink)
References <r7BG1-7d5-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Wang Nan <wangnan0@huawei.com>

Move code for finalizing 'perf.data' to record__finish_output(). It will
be used by following commits to split output to multiple files.

Signed-off-by: He Kuang <hekuang@huawei.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1456479154-136027-23-git-send-email-wangnan0@huawei.com
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c | 37 +++++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index cb583b49a175..46e2772f838e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -468,6 +468,29 @@ static void record__init_features(struct record *rec)
 	perf_header__clear_feat(&session->header, HEADER_STAT);
 }
 
+static void
+record__finish_output(struct record *rec)
+{
+	struct perf_data_file *file = &rec->file;
+	int fd = perf_data_file__fd(file);
+
+	if (file->is_pipe)
+		return;
+
+	rec->session->header.data_size += rec->bytes_written;
+	file->size = lseek(perf_data_file__fd(file), 0, SEEK_CUR);
+
+	if (!rec->no_buildid) {
+		process_buildids(rec);
+
+		if (rec->buildid_all)
+			dsos__hit_all(rec->session);
+	}
+	perf_session__write_header(rec->session, rec->evlist, fd, true);
+
+	return;
+}
+
 static volatile int workload_exec_errno;
 
 /*
@@ -785,18 +808,8 @@ out_child:
 	/* this will be recalculated during process_buildids() */
 	rec->samples = 0;
 
-	if (!err && !file->is_pipe) {
-		rec->session->header.data_size += rec->bytes_written;
-		file->size = lseek(perf_data_file__fd(file), 0, SEEK_CUR);
-
-		if (!rec->no_buildid) {
-			process_buildids(rec);
-
-			if (rec->buildid_all)
-				dsos__hit_all(rec->session);
-		}
-		perf_session__write_header(rec->session, rec->evlist, fd, true);
-	}
+	if (!err)
+		record__finish_output(rec);
 
 	if (!err && !quiet) {
 		char samples[128];
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/11] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-29 20:30 +0100
  [PATCH 07/11] perf data: Explicitly set byte order for integer types Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-29 20:30 +0100
  [PATCH 02/11] perf trace: Check and discard not only 'nr' but also '__syscall_nr' Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-29 20:30 +0100
  [PATCH 04/11] tools lib traceevent: Split pevent_print_event() into specific functionality functions Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-29 20:30 +0100
  [PATCH 09/11] perf record: Extract synthesize code to record__synthesize() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-29 20:30 +0100
  [PATCH 10/11] perf record: Introduce record__finish_output() to finish a perf.data Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-29 20:30 +0100
  Re: [GIT PULL 00/11] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-03-03 09:30 +0100
    Re: [GIT PULL 00/11] perf/core improvements and fixes Jiri Olsa <jolsa@redhat.com> - 2016-03-03 10:20 +0100
      [PATCH] perf tools: Fix locale handling in pmu parsing Jiri Olsa <jolsa@redhat.com> - 2016-03-03 11:00 +0100
        Re: [PATCH] perf tools: Fix locale handling in pmu parsing Andi Kleen <ak@linux.intel.com> - 2016-03-03 17:30 +0100
    Re: [GIT PULL 00/11] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-03-03 15:40 +0100

csiph-web