diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-01-03 13:51:39 -0500 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-01-03 13:51:39 -0500 |
| commit | 70d544d0576775a2b3923a7e68cb49b0313d80c9 (patch) | |
| tree | c848ffcc5b1146fc35d496472349d2e4795b0ff3 /tools/perf/util | |
| parent | 1e7972cc5c16e06f258b0278d8c9adfb5aa75c68 (diff) | |
perf evsel: Delete the event selectors at exit
Freeing all the possibly allocated resources, reducing complexity
on each tool exit path.
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>
Diffstat (limited to 'tools/perf/util')
| -rw-r--r-- | tools/perf/util/parse-events.c | 11 | ||||
| -rw-r--r-- | tools/perf/util/parse-events.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 2d948ad471f..3a142e90d60 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
| @@ -982,3 +982,14 @@ int perf_evsel_list__create_default(void) | |||
| 982 | ++nr_counters; | 982 | ++nr_counters; |
| 983 | return 0; | 983 | return 0; |
| 984 | } | 984 | } |
| 985 | |||
| 986 | void perf_evsel_list__delete(void) | ||
| 987 | { | ||
| 988 | struct perf_evsel *pos, *n; | ||
| 989 | |||
| 990 | list_for_each_entry_safe(pos, n, &evsel_list, node) { | ||
| 991 | list_del_init(&pos->node); | ||
| 992 | perf_evsel__delete(pos); | ||
| 993 | } | ||
| 994 | nr_counters = 0; | ||
| 995 | } | ||
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 0f915a01a3f..0a0abc1d10e 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
| @@ -12,6 +12,7 @@ struct perf_evsel; | |||
| 12 | extern struct list_head evsel_list; | 12 | extern struct list_head evsel_list; |
| 13 | 13 | ||
| 14 | int perf_evsel_list__create_default(void); | 14 | int perf_evsel_list__create_default(void); |
| 15 | void perf_evsel_list__delete(void); | ||
| 15 | 16 | ||
| 16 | struct option; | 17 | struct option; |
| 17 | 18 | ||
