aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/lib
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2019-07-21 07:24:28 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-07-29 17:34:45 -0400
commit6484d2f9dc3ecbf13f07100f7f771d1d779eda04 (patch)
tree0cc83bb778370a267c1d5e2cfd26eb1acde3e4f7 /tools/perf/lib
parent52e22fb8af779e1a26b1cbde1db2f82f78b3ae68 (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.c3
-rw-r--r--tools/perf/lib/include/internal/evlist.h1
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 @@
7void perf_evlist__init(struct perf_evlist *evlist) 7void 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
12void perf_evlist__add(struct perf_evlist *evlist, 13void 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
18void perf_evlist__remove(struct perf_evlist *evlist, 20void 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
5struct perf_evlist { 5struct 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 */