summaryrefslogtreecommitdiff
path: root/tools/perf/tests/hists_link.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/tests/hists_link.c')
-rw-r--r--tools/perf/tests/hists_link.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 14b2ff808b5e..141e2972e34f 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -6,6 +6,7 @@
#include "evsel.h"
#include "evlist.h"
#include "machine.h"
+#include "map.h"
#include "parse-events.h"
#include "hists_common.h"
#include "util/mmap.h"
@@ -87,13 +88,14 @@ static int add_hist_entries(struct evlist *evlist, struct machine *machine)
goto out;
he = hists__add_entry(hists, &al, NULL,
- NULL, NULL, &sample, true);
+ NULL, NULL, NULL, &sample, true);
if (he == NULL) {
addr_location__put(&al);
goto out;
}
fake_common_samples[k].thread = al.thread;
+ map__put(fake_common_samples[k].map);
fake_common_samples[k].map = al.map;
fake_common_samples[k].sym = al.sym;
}
@@ -106,7 +108,7 @@ static int add_hist_entries(struct evlist *evlist, struct machine *machine)
goto out;
he = hists__add_entry(hists, &al, NULL,
- NULL, NULL, &sample, true);
+ NULL, NULL, NULL, &sample, true);
if (he == NULL) {
addr_location__put(&al);
goto out;
@@ -126,11 +128,24 @@ out:
return -1;
}
+static void put_fake_samples(void)
+{
+ size_t i, j;
+
+ for (i = 0; i < ARRAY_SIZE(fake_common_samples); i++)
+ map__put(fake_common_samples[i].map);
+ for (i = 0; i < ARRAY_SIZE(fake_samples); i++) {
+ for (j = 0; j < ARRAY_SIZE(fake_samples[0]); j++)
+ map__put(fake_samples[i][j].map);
+ }
+}
+
static int find_sample(struct sample *samples, size_t nr_samples,
struct thread *t, struct map *m, struct symbol *s)
{
while (nr_samples--) {
- if (samples->thread == t && samples->map == m &&
+ if (samples->thread == t &&
+ RC_CHK_ACCESS(samples->map) == RC_CHK_ACCESS(m) &&
samples->sym == s)
return 1;
samples++;
@@ -336,6 +351,7 @@ out:
evlist__delete(evlist);
reset_output_field();
machines__exit(&machines);
+ put_fake_samples();
return err;
}