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