perf trace: Call machine__exit() at exit
authorAndrei Vagin <[email protected]>
Wed, 8 Nov 2017 00:22:45 +0000 (16:22 -0800)
committerArnaldo Carvalho de Melo <[email protected]>
Thu, 9 Nov 2017 13:17:32 +0000 (10:17 -0300)
Otherwise 'perf trace' leaves a temporary file /tmp/perf-vdso.so-XXXXXX.

  $ perf trace -o log true
  $ ls -l /tmp/perf-vdso.*
  -rw------- 1 root root 8192 Nov  8 03:08 /tmp/perf-vdso.so-5bCpD0

Signed-off-by: Andrei Vagin <[email protected]>
Reviewed-by: Jiri Olsa <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Vasily Averin <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/builtin-trace.c

index 771ddab94bb04746786c2b52389942f1455da48b..d5d7fff1c211ca809db3c6adce0420be0a34e929 100644 (file)
@@ -1138,6 +1138,14 @@ static int trace__symbols_init(struct trace *trace, struct perf_evlist *evlist)
        return err;
 }
 
+static void trace__symbols__exit(struct trace *trace)
+{
+       machine__exit(trace->host);
+       trace->host = NULL;
+
+       symbol__exit();
+}
+
 static int syscall__alloc_arg_fmts(struct syscall *sc, int nr_args)
 {
        int idx;
@@ -2481,6 +2489,8 @@ out_disable:
        }
 
 out_delete_evlist:
+       trace__symbols__exit(trace);
+
        perf_evlist__delete(evlist);
        trace->evlist = NULL;
        trace->live = false;