Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 2 | #include "perf.h" |
| 3 | #include "tests.h" |
| 4 | #include "debug.h" |
| 5 | #include "symbol.h" |
| 6 | #include "sort.h" |
| 7 | #include "evsel.h" |
| 8 | #include "evlist.h" |
| 9 | #include "machine.h" |
| 10 | #include "thread.h" |
| 11 | #include "parse-events.h" |
Namhyung Kim | 6e344a9 | 2014-04-25 12:28:13 +0900 | [diff] [blame] | 12 | #include "hists_common.h" |
Arnaldo Carvalho de Melo | a43783a | 2017-04-18 10:46:11 -0300 | [diff] [blame] | 13 | #include <errno.h> |
Arnaldo Carvalho de Melo | 877a7a1 | 2017-04-17 11:39:06 -0300 | [diff] [blame] | 14 | #include <linux/kernel.h> |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 15 | |
| 16 | struct sample { |
| 17 | u32 pid; |
| 18 | u64 ip; |
| 19 | struct thread *thread; |
| 20 | struct map *map; |
| 21 | struct symbol *sym; |
| 22 | }; |
| 23 | |
Namhyung Kim | 6e344a9 | 2014-04-25 12:28:13 +0900 | [diff] [blame] | 24 | /* For the numbers, see hists_common.c */ |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 25 | static struct sample fake_common_samples[] = { |
| 26 | /* perf [kernel] schedule() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 27 | { .pid = FAKE_PID_PERF1, .ip = FAKE_IP_KERNEL_SCHEDULE, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 28 | /* perf [perf] main() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 29 | { .pid = FAKE_PID_PERF2, .ip = FAKE_IP_PERF_MAIN, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 30 | /* perf [perf] cmd_record() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 31 | { .pid = FAKE_PID_PERF2, .ip = FAKE_IP_PERF_CMD_RECORD, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 32 | /* bash [bash] xmalloc() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 33 | { .pid = FAKE_PID_BASH, .ip = FAKE_IP_BASH_XMALLOC, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 34 | /* bash [libc] malloc() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 35 | { .pid = FAKE_PID_BASH, .ip = FAKE_IP_LIBC_MALLOC, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | static struct sample fake_samples[][5] = { |
| 39 | { |
| 40 | /* perf [perf] run_command() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 41 | { .pid = FAKE_PID_PERF1, .ip = FAKE_IP_PERF_RUN_COMMAND, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 42 | /* perf [libc] malloc() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 43 | { .pid = FAKE_PID_PERF1, .ip = FAKE_IP_LIBC_MALLOC, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 44 | /* perf [kernel] page_fault() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 45 | { .pid = FAKE_PID_PERF1, .ip = FAKE_IP_KERNEL_PAGE_FAULT, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 46 | /* perf [kernel] sys_perf_event_open() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 47 | { .pid = FAKE_PID_PERF2, .ip = FAKE_IP_KERNEL_SYS_PERF_EVENT_OPEN, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 48 | /* bash [libc] free() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 49 | { .pid = FAKE_PID_BASH, .ip = FAKE_IP_LIBC_FREE, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 50 | }, |
| 51 | { |
| 52 | /* perf [libc] free() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 53 | { .pid = FAKE_PID_PERF2, .ip = FAKE_IP_LIBC_FREE, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 54 | /* bash [libc] malloc() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 55 | { .pid = FAKE_PID_BASH, .ip = FAKE_IP_LIBC_MALLOC, }, /* will be merged */ |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 56 | /* bash [bash] xfee() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 57 | { .pid = FAKE_PID_BASH, .ip = FAKE_IP_BASH_XFREE, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 58 | /* bash [libc] realloc() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 59 | { .pid = FAKE_PID_BASH, .ip = FAKE_IP_LIBC_REALLOC, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 60 | /* bash [kernel] page_fault() */ |
Namhyung Kim | a1891aa | 2014-05-23 14:59:57 +0900 | [diff] [blame] | 61 | { .pid = FAKE_PID_BASH, .ip = FAKE_IP_KERNEL_PAGE_FAULT, }, |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 62 | }, |
| 63 | }; |
| 64 | |
| 65 | static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) |
| 66 | { |
| 67 | struct perf_evsel *evsel; |
| 68 | struct addr_location al; |
| 69 | struct hist_entry *he; |
Namhyung Kim | fd36f3d | 2015-12-23 02:06:58 +0900 | [diff] [blame] | 70 | struct perf_sample sample = { .period = 1, .weight = 1, }; |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 71 | size_t i = 0, k; |
| 72 | |
| 73 | /* |
| 74 | * each evsel will have 10 samples - 5 common and 5 distinct. |
| 75 | * However the second evsel also has a collapsed entry for |
| 76 | * "bash [libc] malloc" so total 9 entries will be in the tree. |
| 77 | */ |
Arnaldo Carvalho de Melo | e5cadb9 | 2016-06-23 11:26:15 -0300 | [diff] [blame] | 78 | evlist__for_each_entry(evlist, evsel) { |
Arnaldo Carvalho de Melo | 4ea062ed | 2014-10-09 13:13:41 -0300 | [diff] [blame] | 79 | struct hists *hists = evsel__hists(evsel); |
| 80 | |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 81 | for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) { |
Arnaldo Carvalho de Melo | 473398a | 2016-03-22 18:23:43 -0300 | [diff] [blame] | 82 | sample.cpumode = PERF_RECORD_MISC_USER; |
Adrian Hunter | ef89325 | 2013-08-27 11:23:06 +0300 | [diff] [blame] | 83 | sample.pid = fake_common_samples[k].pid; |
Namhyung Kim | 13ce34d | 2014-05-12 09:56:42 +0900 | [diff] [blame] | 84 | sample.tid = fake_common_samples[k].pid; |
Adrian Hunter | ef89325 | 2013-08-27 11:23:06 +0300 | [diff] [blame] | 85 | sample.ip = fake_common_samples[k].ip; |
Arnaldo Carvalho de Melo | bb3eb56 | 2016-03-22 18:39:09 -0300 | [diff] [blame] | 86 | |
| 87 | if (machine__resolve(machine, &al, &sample) < 0) |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 88 | goto out; |
| 89 | |
Jiri Olsa | 0102ef3 | 2016-06-14 20:19:21 +0200 | [diff] [blame] | 90 | he = hists__add_entry(hists, &al, NULL, |
Namhyung Kim | fd36f3d | 2015-12-23 02:06:58 +0900 | [diff] [blame] | 91 | NULL, NULL, &sample, true); |
Arnaldo Carvalho de Melo | b91fc39 | 2015-04-06 20:43:22 -0300 | [diff] [blame] | 92 | if (he == NULL) { |
| 93 | addr_location__put(&al); |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 94 | goto out; |
Arnaldo Carvalho de Melo | b91fc39 | 2015-04-06 20:43:22 -0300 | [diff] [blame] | 95 | } |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 96 | |
| 97 | fake_common_samples[k].thread = al.thread; |
| 98 | fake_common_samples[k].map = al.map; |
| 99 | fake_common_samples[k].sym = al.sym; |
| 100 | } |
| 101 | |
| 102 | for (k = 0; k < ARRAY_SIZE(fake_samples[i]); k++) { |
Adrian Hunter | ef89325 | 2013-08-27 11:23:06 +0300 | [diff] [blame] | 103 | sample.pid = fake_samples[i][k].pid; |
Namhyung Kim | 13ce34d | 2014-05-12 09:56:42 +0900 | [diff] [blame] | 104 | sample.tid = fake_samples[i][k].pid; |
Adrian Hunter | ef89325 | 2013-08-27 11:23:06 +0300 | [diff] [blame] | 105 | sample.ip = fake_samples[i][k].ip; |
Arnaldo Carvalho de Melo | bb3eb56 | 2016-03-22 18:39:09 -0300 | [diff] [blame] | 106 | if (machine__resolve(machine, &al, &sample) < 0) |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 107 | goto out; |
| 108 | |
Jiri Olsa | 0102ef3 | 2016-06-14 20:19:21 +0200 | [diff] [blame] | 109 | he = hists__add_entry(hists, &al, NULL, |
Namhyung Kim | fd36f3d | 2015-12-23 02:06:58 +0900 | [diff] [blame] | 110 | NULL, NULL, &sample, true); |
Arnaldo Carvalho de Melo | b91fc39 | 2015-04-06 20:43:22 -0300 | [diff] [blame] | 111 | if (he == NULL) { |
| 112 | addr_location__put(&al); |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 113 | goto out; |
Arnaldo Carvalho de Melo | b91fc39 | 2015-04-06 20:43:22 -0300 | [diff] [blame] | 114 | } |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 115 | |
| 116 | fake_samples[i][k].thread = al.thread; |
| 117 | fake_samples[i][k].map = al.map; |
| 118 | fake_samples[i][k].sym = al.sym; |
| 119 | } |
| 120 | i++; |
| 121 | } |
| 122 | |
| 123 | return 0; |
| 124 | |
| 125 | out: |
| 126 | pr_debug("Not enough memory for adding a hist entry\n"); |
| 127 | return -1; |
| 128 | } |
| 129 | |
| 130 | static int find_sample(struct sample *samples, size_t nr_samples, |
| 131 | struct thread *t, struct map *m, struct symbol *s) |
| 132 | { |
| 133 | while (nr_samples--) { |
| 134 | if (samples->thread == t && samples->map == m && |
| 135 | samples->sym == s) |
| 136 | return 1; |
| 137 | samples++; |
| 138 | } |
| 139 | return 0; |
| 140 | } |
| 141 | |
| 142 | static int __validate_match(struct hists *hists) |
| 143 | { |
| 144 | size_t count = 0; |
| 145 | struct rb_root *root; |
| 146 | struct rb_node *node; |
| 147 | |
| 148 | /* |
| 149 | * Only entries from fake_common_samples should have a pair. |
| 150 | */ |
Jiri Olsa | 5222503 | 2016-05-03 13:54:42 +0200 | [diff] [blame] | 151 | if (hists__has(hists, need_collapse)) |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 152 | root = &hists->entries_collapsed; |
| 153 | else |
| 154 | root = hists->entries_in; |
| 155 | |
| 156 | node = rb_first(root); |
| 157 | while (node) { |
| 158 | struct hist_entry *he; |
| 159 | |
| 160 | he = rb_entry(node, struct hist_entry, rb_node_in); |
| 161 | |
| 162 | if (hist_entry__has_pairs(he)) { |
| 163 | if (find_sample(fake_common_samples, |
| 164 | ARRAY_SIZE(fake_common_samples), |
| 165 | he->thread, he->ms.map, he->ms.sym)) { |
| 166 | count++; |
| 167 | } else { |
| 168 | pr_debug("Can't find the matched entry\n"); |
| 169 | return -1; |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | node = rb_next(node); |
| 174 | } |
| 175 | |
| 176 | if (count != ARRAY_SIZE(fake_common_samples)) { |
| 177 | pr_debug("Invalid count for matched entries: %zd of %zd\n", |
| 178 | count, ARRAY_SIZE(fake_common_samples)); |
| 179 | return -1; |
| 180 | } |
| 181 | |
| 182 | return 0; |
| 183 | } |
| 184 | |
| 185 | static int validate_match(struct hists *leader, struct hists *other) |
| 186 | { |
| 187 | return __validate_match(leader) || __validate_match(other); |
| 188 | } |
| 189 | |
| 190 | static int __validate_link(struct hists *hists, int idx) |
| 191 | { |
| 192 | size_t count = 0; |
| 193 | size_t count_pair = 0; |
| 194 | size_t count_dummy = 0; |
| 195 | struct rb_root *root; |
| 196 | struct rb_node *node; |
| 197 | |
| 198 | /* |
| 199 | * Leader hists (idx = 0) will have dummy entries from other, |
| 200 | * and some entries will have no pair. However every entry |
| 201 | * in other hists should have (dummy) pair. |
| 202 | */ |
Jiri Olsa | 5222503 | 2016-05-03 13:54:42 +0200 | [diff] [blame] | 203 | if (hists__has(hists, need_collapse)) |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 204 | root = &hists->entries_collapsed; |
| 205 | else |
| 206 | root = hists->entries_in; |
| 207 | |
| 208 | node = rb_first(root); |
| 209 | while (node) { |
| 210 | struct hist_entry *he; |
| 211 | |
| 212 | he = rb_entry(node, struct hist_entry, rb_node_in); |
| 213 | |
| 214 | if (hist_entry__has_pairs(he)) { |
| 215 | if (!find_sample(fake_common_samples, |
| 216 | ARRAY_SIZE(fake_common_samples), |
| 217 | he->thread, he->ms.map, he->ms.sym) && |
| 218 | !find_sample(fake_samples[idx], |
| 219 | ARRAY_SIZE(fake_samples[idx]), |
| 220 | he->thread, he->ms.map, he->ms.sym)) { |
| 221 | count_dummy++; |
| 222 | } |
| 223 | count_pair++; |
| 224 | } else if (idx) { |
| 225 | pr_debug("A entry from the other hists should have pair\n"); |
| 226 | return -1; |
| 227 | } |
| 228 | |
| 229 | count++; |
| 230 | node = rb_next(node); |
| 231 | } |
| 232 | |
| 233 | /* |
| 234 | * Note that we have a entry collapsed in the other (idx = 1) hists. |
| 235 | */ |
| 236 | if (idx == 0) { |
| 237 | if (count_dummy != ARRAY_SIZE(fake_samples[1]) - 1) { |
| 238 | pr_debug("Invalid count of dummy entries: %zd of %zd\n", |
| 239 | count_dummy, ARRAY_SIZE(fake_samples[1]) - 1); |
| 240 | return -1; |
| 241 | } |
| 242 | if (count != count_pair + ARRAY_SIZE(fake_samples[0])) { |
| 243 | pr_debug("Invalid count of total leader entries: %zd of %zd\n", |
| 244 | count, count_pair + ARRAY_SIZE(fake_samples[0])); |
| 245 | return -1; |
| 246 | } |
| 247 | } else { |
| 248 | if (count != count_pair) { |
| 249 | pr_debug("Invalid count of total other entries: %zd of %zd\n", |
| 250 | count, count_pair); |
| 251 | return -1; |
| 252 | } |
| 253 | if (count_dummy > 0) { |
| 254 | pr_debug("Other hists should not have dummy entries: %zd\n", |
| 255 | count_dummy); |
| 256 | return -1; |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | return 0; |
| 261 | } |
| 262 | |
| 263 | static int validate_link(struct hists *leader, struct hists *other) |
| 264 | { |
| 265 | return __validate_link(leader, 0) || __validate_link(other, 1); |
| 266 | } |
| 267 | |
Arnaldo Carvalho de Melo | 81f17c9 | 2017-08-03 15:16:31 -0300 | [diff] [blame] | 268 | int test__hists_link(struct test *test __maybe_unused, int subtest __maybe_unused) |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 269 | { |
| 270 | int err = -1; |
Arnaldo Carvalho de Melo | 4ea062ed | 2014-10-09 13:13:41 -0300 | [diff] [blame] | 271 | struct hists *hists, *first_hists; |
Arnaldo Carvalho de Melo | 876650e | 2012-12-18 19:15:48 -0300 | [diff] [blame] | 272 | struct machines machines; |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 273 | struct machine *machine = NULL; |
| 274 | struct perf_evsel *evsel, *first; |
Namhyung Kim | 334fe7a | 2013-03-11 16:43:12 +0900 | [diff] [blame] | 275 | struct perf_evlist *evlist = perf_evlist__new(); |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 276 | |
| 277 | if (evlist == NULL) |
| 278 | return -ENOMEM; |
| 279 | |
Jiri Olsa | b39b839 | 2015-04-22 21:10:16 +0200 | [diff] [blame] | 280 | err = parse_events(evlist, "cpu-clock", NULL); |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 281 | if (err) |
| 282 | goto out; |
Jiri Olsa | b39b839 | 2015-04-22 21:10:16 +0200 | [diff] [blame] | 283 | err = parse_events(evlist, "task-clock", NULL); |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 284 | if (err) |
| 285 | goto out; |
| 286 | |
Wang Nan | b0500c1 | 2016-01-11 13:48:03 +0000 | [diff] [blame] | 287 | err = TEST_FAIL; |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 288 | /* default sort order (comm,dso,sym) will be used */ |
Namhyung Kim | 40184c4 | 2015-12-23 02:07:01 +0900 | [diff] [blame] | 289 | if (setup_sorting(NULL) < 0) |
Namhyung Kim | 5530998 | 2013-02-06 14:57:16 +0900 | [diff] [blame] | 290 | goto out; |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 291 | |
Arnaldo Carvalho de Melo | 876650e | 2012-12-18 19:15:48 -0300 | [diff] [blame] | 292 | machines__init(&machines); |
| 293 | |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 294 | /* setup threads/dso/map/symbols also */ |
Arnaldo Carvalho de Melo | 876650e | 2012-12-18 19:15:48 -0300 | [diff] [blame] | 295 | machine = setup_fake_machine(&machines); |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 296 | if (!machine) |
| 297 | goto out; |
| 298 | |
| 299 | if (verbose > 1) |
| 300 | machine__fprintf(machine, stderr); |
| 301 | |
| 302 | /* process sample events */ |
| 303 | err = add_hist_entries(evlist, machine); |
| 304 | if (err < 0) |
| 305 | goto out; |
| 306 | |
Arnaldo Carvalho de Melo | e5cadb9 | 2016-06-23 11:26:15 -0300 | [diff] [blame] | 307 | evlist__for_each_entry(evlist, evsel) { |
Arnaldo Carvalho de Melo | 4ea062ed | 2014-10-09 13:13:41 -0300 | [diff] [blame] | 308 | hists = evsel__hists(evsel); |
| 309 | hists__collapse_resort(hists, NULL); |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 310 | |
| 311 | if (verbose > 2) |
Arnaldo Carvalho de Melo | 4ea062ed | 2014-10-09 13:13:41 -0300 | [diff] [blame] | 312 | print_hists_in(hists); |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 313 | } |
| 314 | |
| 315 | first = perf_evlist__first(evlist); |
| 316 | evsel = perf_evlist__last(evlist); |
| 317 | |
Arnaldo Carvalho de Melo | 4ea062ed | 2014-10-09 13:13:41 -0300 | [diff] [blame] | 318 | first_hists = evsel__hists(first); |
| 319 | hists = evsel__hists(evsel); |
| 320 | |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 321 | /* match common entries */ |
Arnaldo Carvalho de Melo | 4ea062ed | 2014-10-09 13:13:41 -0300 | [diff] [blame] | 322 | hists__match(first_hists, hists); |
| 323 | err = validate_match(first_hists, hists); |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 324 | if (err) |
| 325 | goto out; |
| 326 | |
| 327 | /* link common and/or dummy entries */ |
Arnaldo Carvalho de Melo | 4ea062ed | 2014-10-09 13:13:41 -0300 | [diff] [blame] | 328 | hists__link(first_hists, hists); |
| 329 | err = validate_link(first_hists, hists); |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 330 | if (err) |
| 331 | goto out; |
| 332 | |
| 333 | err = 0; |
| 334 | |
| 335 | out: |
| 336 | /* tear down everything */ |
| 337 | perf_evlist__delete(evlist); |
Namhyung Kim | f21d181 | 2014-05-12 14:43:18 +0900 | [diff] [blame] | 338 | reset_output_field(); |
Arnaldo Carvalho de Melo | 876650e | 2012-12-18 19:15:48 -0300 | [diff] [blame] | 339 | machines__exit(&machines); |
Namhyung Kim | f8ebb0c | 2012-12-10 17:29:57 +0900 | [diff] [blame] | 340 | |
| 341 | return err; |
| 342 | } |