Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 712a4b60 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf record: Delay setting the header writing atexit call



While testing the --filter option I noticed that we were writing lots of
unneeded stuff to the perf.data header when the filter ioctl fails, so
move the atexit(atexit_header) call to after we create the counters
successfully.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent fec9cbd1
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -538,11 +538,6 @@ static int __cmd_record(int argc, const char **argv)
	if (have_tracepoints(&evsel_list->entries))
	if (have_tracepoints(&evsel_list->entries))
		perf_header__set_feat(&session->header, HEADER_TRACE_INFO);
		perf_header__set_feat(&session->header, HEADER_TRACE_INFO);


	/*
 	 * perf_session__delete(session) will be called at atexit_header()
	 */
	atexit(atexit_header);

	if (forks) {
	if (forks) {
		child_pid = fork();
		child_pid = fork();
		if (child_pid < 0) {
		if (child_pid < 0) {
@@ -601,6 +596,11 @@ static int __cmd_record(int argc, const char **argv)


	perf_session__set_sample_type(session, sample_type);
	perf_session__set_sample_type(session, sample_type);


	/*
	 * perf_session__delete(session) will be called at atexit_header()
	 */
	atexit(atexit_header);

	if (pipe_output) {
	if (pipe_output) {
		err = perf_header__write_pipe(output);
		err = perf_header__write_pipe(output);
		if (err < 0)
		if (err < 0)