diff options
author | Jiri Olsa <jolsa@kernel.org> | 2019-07-21 07:24:28 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-29 17:34:45 -0400 |
commit | 6484d2f9dc3ecbf13f07100f7f771d1d779eda04 (patch) | |
tree | 0cc83bb778370a267c1d5e2cfd26eb1acde3e4f7 /tools/perf/lib | |
parent | 52e22fb8af779e1a26b1cbde1db2f82f78b3ae68 (diff) |
libperf: Add nr_entries to struct perf_evlist
Move nr_entries count from 'struct perf' to into perf_evlist struct.
Committer notes:
Fix tools/perf/arch/s390/util/auxtrace.c case. And also the comment in
tools/perf/util/annotate.h.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190721112506.12306-42-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/lib')
-rw-r--r-- | tools/perf/lib/evlist.c | 3 | ||||
-rw-r--r-- | tools/perf/lib/include/internal/evlist.h | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/tools/perf/lib/evlist.c b/tools/perf/lib/evlist.c index 023fe4b44131..1b27fd2de9b9 100644 --- a/tools/perf/lib/evlist.c +++ b/tools/perf/lib/evlist.c | |||
@@ -7,16 +7,19 @@ | |||
7 | void perf_evlist__init(struct perf_evlist *evlist) | 7 | void perf_evlist__init(struct perf_evlist *evlist) |
8 | { | 8 | { |
9 | INIT_LIST_HEAD(&evlist->entries); | 9 | INIT_LIST_HEAD(&evlist->entries); |
10 | evlist->nr_entries = 0; | ||
10 | } | 11 | } |
11 | 12 | ||
12 | void perf_evlist__add(struct perf_evlist *evlist, | 13 | void perf_evlist__add(struct perf_evlist *evlist, |
13 | struct perf_evsel *evsel) | 14 | struct perf_evsel *evsel) |
14 | { | 15 | { |
15 | list_add_tail(&evsel->node, &evlist->entries); | 16 | list_add_tail(&evsel->node, &evlist->entries); |
17 | evlist->nr_entries += 1; | ||
16 | } | 18 | } |
17 | 19 | ||
18 | void perf_evlist__remove(struct perf_evlist *evlist, | 20 | void perf_evlist__remove(struct perf_evlist *evlist, |
19 | struct perf_evsel *evsel) | 21 | struct perf_evsel *evsel) |
20 | { | 22 | { |
21 | list_del_init(&evsel->node); | 23 | list_del_init(&evsel->node); |
24 | evlist->nr_entries -= 1; | ||
22 | } | 25 | } |
diff --git a/tools/perf/lib/include/internal/evlist.h b/tools/perf/lib/include/internal/evlist.h index 7fbfe5716652..a12c712a9197 100644 --- a/tools/perf/lib/include/internal/evlist.h +++ b/tools/perf/lib/include/internal/evlist.h | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | struct perf_evlist { | 5 | struct perf_evlist { |
6 | struct list_head entries; | 6 | struct list_head entries; |
7 | int nr_entries; | ||
7 | }; | 8 | }; |
8 | 9 | ||
9 | #endif /* __LIBPERF_INTERNAL_EVLIST_H */ | 10 | #endif /* __LIBPERF_INTERNAL_EVLIST_H */ |