libperf: Add perf_evlist__reset_id_hash()
Add the perf_evlist__reset_id_hash() function as an internal function so that it can be called by perf to reset the hash table. This is necessary for 'perf stat' to run the workload multiple times. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: https://lore.kernel.org/r/20210225035148.778569-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
034f7ee130
commit
e2a99c9a9a
|
@ -26,13 +26,10 @@
|
||||||
|
|
||||||
void perf_evlist__init(struct perf_evlist *evlist)
|
void perf_evlist__init(struct perf_evlist *evlist)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < PERF_EVLIST__HLIST_SIZE; ++i)
|
|
||||||
INIT_HLIST_HEAD(&evlist->heads[i]);
|
|
||||||
INIT_LIST_HEAD(&evlist->entries);
|
INIT_LIST_HEAD(&evlist->entries);
|
||||||
evlist->nr_entries = 0;
|
evlist->nr_entries = 0;
|
||||||
fdarray__init(&evlist->pollfd, 64);
|
fdarray__init(&evlist->pollfd, 64);
|
||||||
|
perf_evlist__reset_id_hash(evlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __perf_evlist__propagate_maps(struct perf_evlist *evlist,
|
static void __perf_evlist__propagate_maps(struct perf_evlist *evlist,
|
||||||
|
@ -237,6 +234,14 @@ static void perf_evlist__id_hash(struct perf_evlist *evlist,
|
||||||
hlist_add_head(&sid->node, &evlist->heads[hash]);
|
hlist_add_head(&sid->node, &evlist->heads[hash]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void perf_evlist__reset_id_hash(struct perf_evlist *evlist)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < PERF_EVLIST__HLIST_SIZE; ++i)
|
||||||
|
INIT_HLIST_HEAD(&evlist->heads[i]);
|
||||||
|
}
|
||||||
|
|
||||||
void perf_evlist__id_add(struct perf_evlist *evlist,
|
void perf_evlist__id_add(struct perf_evlist *evlist,
|
||||||
struct perf_evsel *evsel,
|
struct perf_evsel *evsel,
|
||||||
int cpu, int thread, u64 id)
|
int cpu, int thread, u64 id)
|
||||||
|
|
|
@ -124,4 +124,6 @@ int perf_evlist__id_add_fd(struct perf_evlist *evlist,
|
||||||
struct perf_evsel *evsel,
|
struct perf_evsel *evsel,
|
||||||
int cpu, int thread, int fd);
|
int cpu, int thread, int fd);
|
||||||
|
|
||||||
|
void perf_evlist__reset_id_hash(struct perf_evlist *evlist);
|
||||||
|
|
||||||
#endif /* __LIBPERF_INTERNAL_EVLIST_H */
|
#endif /* __LIBPERF_INTERNAL_EVLIST_H */
|
||||||
|
|
Loading…
Reference in New Issue