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