Skip to content

Commit 712a4b6

Browse files
committed
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: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent fec9cbd commit 712a4b6

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎tools/perf/builtin-record.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -538,11 +538,6 @@ static int __cmd_record(int argc, const char **argv)
538538
if (have_tracepoints(&evsel_list->entries))
539539
perf_header__set_feat(&session->header, HEADER_TRACE_INFO);
540540

541-
/*
542-
* perf_session__delete(session) will be called at atexit_header()
543-
*/
544-
atexit(atexit_header);
545-
546541
if (forks) {
547542
child_pid = fork();
548543
if (child_pid < 0) {
@@ -601,6 +596,11 @@ static int __cmd_record(int argc, const char **argv)
601596

602597
perf_session__set_sample_type(session, sample_type);
603598

599+
/*
600+
* perf_session__delete(session) will be called at atexit_header()
601+
*/
602+
atexit(atexit_header);
603+
604604
if (pipe_output) {
605605
err = perf_header__write_pipe(output);
606606
if (err < 0)

0 commit comments

Comments
 (0)