1f8ebb0cdSNamhyung Kim #include "perf.h" 2f8ebb0cdSNamhyung Kim #include "tests.h" 3f8ebb0cdSNamhyung Kim #include "debug.h" 4f8ebb0cdSNamhyung Kim #include "symbol.h" 5f8ebb0cdSNamhyung Kim #include "sort.h" 6f8ebb0cdSNamhyung Kim #include "evsel.h" 7f8ebb0cdSNamhyung Kim #include "evlist.h" 8f8ebb0cdSNamhyung Kim #include "machine.h" 9f8ebb0cdSNamhyung Kim #include "thread.h" 10f8ebb0cdSNamhyung Kim #include "parse-events.h" 11*6e344a95SNamhyung Kim #include "hists_common.h" 12f8ebb0cdSNamhyung Kim 13f8ebb0cdSNamhyung Kim struct sample { 14f8ebb0cdSNamhyung Kim u32 pid; 15f8ebb0cdSNamhyung Kim u64 ip; 16f8ebb0cdSNamhyung Kim struct thread *thread; 17f8ebb0cdSNamhyung Kim struct map *map; 18f8ebb0cdSNamhyung Kim struct symbol *sym; 19f8ebb0cdSNamhyung Kim }; 20f8ebb0cdSNamhyung Kim 21*6e344a95SNamhyung Kim /* For the numbers, see hists_common.c */ 22f8ebb0cdSNamhyung Kim static struct sample fake_common_samples[] = { 23f8ebb0cdSNamhyung Kim /* perf [kernel] schedule() */ 24f8ebb0cdSNamhyung Kim { .pid = 100, .ip = 0xf0000 + 700, }, 25f8ebb0cdSNamhyung Kim /* perf [perf] main() */ 26f8ebb0cdSNamhyung Kim { .pid = 200, .ip = 0x40000 + 700, }, 27f8ebb0cdSNamhyung Kim /* perf [perf] cmd_record() */ 28f8ebb0cdSNamhyung Kim { .pid = 200, .ip = 0x40000 + 900, }, 29f8ebb0cdSNamhyung Kim /* bash [bash] xmalloc() */ 30f8ebb0cdSNamhyung Kim { .pid = 300, .ip = 0x40000 + 800, }, 31f8ebb0cdSNamhyung Kim /* bash [libc] malloc() */ 32f8ebb0cdSNamhyung Kim { .pid = 300, .ip = 0x50000 + 700, }, 33f8ebb0cdSNamhyung Kim }; 34f8ebb0cdSNamhyung Kim 35f8ebb0cdSNamhyung Kim static struct sample fake_samples[][5] = { 36f8ebb0cdSNamhyung Kim { 37f8ebb0cdSNamhyung Kim /* perf [perf] run_command() */ 38f8ebb0cdSNamhyung Kim { .pid = 100, .ip = 0x40000 + 800, }, 39f8ebb0cdSNamhyung Kim /* perf [libc] malloc() */ 40f8ebb0cdSNamhyung Kim { .pid = 100, .ip = 0x50000 + 700, }, 41f8ebb0cdSNamhyung Kim /* perf [kernel] page_fault() */ 42f8ebb0cdSNamhyung Kim { .pid = 100, .ip = 0xf0000 + 800, }, 43f8ebb0cdSNamhyung Kim /* perf [kernel] sys_perf_event_open() */ 44f8ebb0cdSNamhyung Kim { .pid = 200, .ip = 0xf0000 + 900, }, 45f8ebb0cdSNamhyung Kim /* bash [libc] free() */ 46f8ebb0cdSNamhyung Kim { .pid = 300, .ip = 0x50000 + 800, }, 47f8ebb0cdSNamhyung Kim }, 48f8ebb0cdSNamhyung Kim { 49f8ebb0cdSNamhyung Kim /* perf [libc] free() */ 50f8ebb0cdSNamhyung Kim { .pid = 200, .ip = 0x50000 + 800, }, 51f8ebb0cdSNamhyung Kim /* bash [libc] malloc() */ 52f8ebb0cdSNamhyung Kim { .pid = 300, .ip = 0x50000 + 700, }, /* will be merged */ 53f8ebb0cdSNamhyung Kim /* bash [bash] xfee() */ 54f8ebb0cdSNamhyung Kim { .pid = 300, .ip = 0x40000 + 900, }, 55f8ebb0cdSNamhyung Kim /* bash [libc] realloc() */ 56f8ebb0cdSNamhyung Kim { .pid = 300, .ip = 0x50000 + 900, }, 57f8ebb0cdSNamhyung Kim /* bash [kernel] page_fault() */ 58f8ebb0cdSNamhyung Kim { .pid = 300, .ip = 0xf0000 + 800, }, 59f8ebb0cdSNamhyung Kim }, 60f8ebb0cdSNamhyung Kim }; 61f8ebb0cdSNamhyung Kim 62f8ebb0cdSNamhyung Kim static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) 63f8ebb0cdSNamhyung Kim { 64f8ebb0cdSNamhyung Kim struct perf_evsel *evsel; 65f8ebb0cdSNamhyung Kim struct addr_location al; 66f8ebb0cdSNamhyung Kim struct hist_entry *he; 67f8ebb0cdSNamhyung Kim struct perf_sample sample = { .cpu = 0, }; 68f8ebb0cdSNamhyung Kim size_t i = 0, k; 69f8ebb0cdSNamhyung Kim 70f8ebb0cdSNamhyung Kim /* 71f8ebb0cdSNamhyung Kim * each evsel will have 10 samples - 5 common and 5 distinct. 72f8ebb0cdSNamhyung Kim * However the second evsel also has a collapsed entry for 73f8ebb0cdSNamhyung Kim * "bash [libc] malloc" so total 9 entries will be in the tree. 74f8ebb0cdSNamhyung Kim */ 750050f7aaSArnaldo Carvalho de Melo evlist__for_each(evlist, evsel) { 76f8ebb0cdSNamhyung Kim for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) { 77f8ebb0cdSNamhyung Kim const union perf_event event = { 78f8ebb0cdSNamhyung Kim .header = { 79f8ebb0cdSNamhyung Kim .misc = PERF_RECORD_MISC_USER, 80f8ebb0cdSNamhyung Kim }, 81f8ebb0cdSNamhyung Kim }; 82f8ebb0cdSNamhyung Kim 83ef89325fSAdrian Hunter sample.pid = fake_common_samples[k].pid; 84ef89325fSAdrian Hunter sample.ip = fake_common_samples[k].ip; 85f8ebb0cdSNamhyung Kim if (perf_event__preprocess_sample(&event, machine, &al, 86e44baa3eSAdrian Hunter &sample) < 0) 87f8ebb0cdSNamhyung Kim goto out; 88f8ebb0cdSNamhyung Kim 89475eeab9SAndi Kleen he = __hists__add_entry(&evsel->hists, &al, NULL, 9041a4e6e2SNamhyung Kim NULL, NULL, 1, 1, 0); 91f8ebb0cdSNamhyung Kim if (he == NULL) 92f8ebb0cdSNamhyung Kim goto out; 93f8ebb0cdSNamhyung Kim 94f8ebb0cdSNamhyung Kim fake_common_samples[k].thread = al.thread; 95f8ebb0cdSNamhyung Kim fake_common_samples[k].map = al.map; 96f8ebb0cdSNamhyung Kim fake_common_samples[k].sym = al.sym; 97f8ebb0cdSNamhyung Kim } 98f8ebb0cdSNamhyung Kim 99f8ebb0cdSNamhyung Kim for (k = 0; k < ARRAY_SIZE(fake_samples[i]); k++) { 100f8ebb0cdSNamhyung Kim const union perf_event event = { 101f8ebb0cdSNamhyung Kim .header = { 102f8ebb0cdSNamhyung Kim .misc = PERF_RECORD_MISC_USER, 103f8ebb0cdSNamhyung Kim }, 104f8ebb0cdSNamhyung Kim }; 105f8ebb0cdSNamhyung Kim 106ef89325fSAdrian Hunter sample.pid = fake_samples[i][k].pid; 107ef89325fSAdrian Hunter sample.ip = fake_samples[i][k].ip; 108f8ebb0cdSNamhyung Kim if (perf_event__preprocess_sample(&event, machine, &al, 109e44baa3eSAdrian Hunter &sample) < 0) 110f8ebb0cdSNamhyung Kim goto out; 111f8ebb0cdSNamhyung Kim 11241a4e6e2SNamhyung Kim he = __hists__add_entry(&evsel->hists, &al, NULL, 11341a4e6e2SNamhyung Kim NULL, NULL, 1, 1, 0); 114f8ebb0cdSNamhyung Kim if (he == NULL) 115f8ebb0cdSNamhyung Kim goto out; 116f8ebb0cdSNamhyung Kim 117f8ebb0cdSNamhyung Kim fake_samples[i][k].thread = al.thread; 118f8ebb0cdSNamhyung Kim fake_samples[i][k].map = al.map; 119f8ebb0cdSNamhyung Kim fake_samples[i][k].sym = al.sym; 120f8ebb0cdSNamhyung Kim } 121f8ebb0cdSNamhyung Kim i++; 122f8ebb0cdSNamhyung Kim } 123f8ebb0cdSNamhyung Kim 124f8ebb0cdSNamhyung Kim return 0; 125f8ebb0cdSNamhyung Kim 126f8ebb0cdSNamhyung Kim out: 127f8ebb0cdSNamhyung Kim pr_debug("Not enough memory for adding a hist entry\n"); 128f8ebb0cdSNamhyung Kim return -1; 129f8ebb0cdSNamhyung Kim } 130f8ebb0cdSNamhyung Kim 131f8ebb0cdSNamhyung Kim static int find_sample(struct sample *samples, size_t nr_samples, 132f8ebb0cdSNamhyung Kim struct thread *t, struct map *m, struct symbol *s) 133f8ebb0cdSNamhyung Kim { 134f8ebb0cdSNamhyung Kim while (nr_samples--) { 135f8ebb0cdSNamhyung Kim if (samples->thread == t && samples->map == m && 136f8ebb0cdSNamhyung Kim samples->sym == s) 137f8ebb0cdSNamhyung Kim return 1; 138f8ebb0cdSNamhyung Kim samples++; 139f8ebb0cdSNamhyung Kim } 140f8ebb0cdSNamhyung Kim return 0; 141f8ebb0cdSNamhyung Kim } 142f8ebb0cdSNamhyung Kim 143f8ebb0cdSNamhyung Kim static int __validate_match(struct hists *hists) 144f8ebb0cdSNamhyung Kim { 145f8ebb0cdSNamhyung Kim size_t count = 0; 146f8ebb0cdSNamhyung Kim struct rb_root *root; 147f8ebb0cdSNamhyung Kim struct rb_node *node; 148f8ebb0cdSNamhyung Kim 149f8ebb0cdSNamhyung Kim /* 150f8ebb0cdSNamhyung Kim * Only entries from fake_common_samples should have a pair. 151f8ebb0cdSNamhyung Kim */ 152f8ebb0cdSNamhyung Kim if (sort__need_collapse) 153f8ebb0cdSNamhyung Kim root = &hists->entries_collapsed; 154f8ebb0cdSNamhyung Kim else 155f8ebb0cdSNamhyung Kim root = hists->entries_in; 156f8ebb0cdSNamhyung Kim 157f8ebb0cdSNamhyung Kim node = rb_first(root); 158f8ebb0cdSNamhyung Kim while (node) { 159f8ebb0cdSNamhyung Kim struct hist_entry *he; 160f8ebb0cdSNamhyung Kim 161f8ebb0cdSNamhyung Kim he = rb_entry(node, struct hist_entry, rb_node_in); 162f8ebb0cdSNamhyung Kim 163f8ebb0cdSNamhyung Kim if (hist_entry__has_pairs(he)) { 164f8ebb0cdSNamhyung Kim if (find_sample(fake_common_samples, 165f8ebb0cdSNamhyung Kim ARRAY_SIZE(fake_common_samples), 166f8ebb0cdSNamhyung Kim he->thread, he->ms.map, he->ms.sym)) { 167f8ebb0cdSNamhyung Kim count++; 168f8ebb0cdSNamhyung Kim } else { 169f8ebb0cdSNamhyung Kim pr_debug("Can't find the matched entry\n"); 170f8ebb0cdSNamhyung Kim return -1; 171f8ebb0cdSNamhyung Kim } 172f8ebb0cdSNamhyung Kim } 173f8ebb0cdSNamhyung Kim 174f8ebb0cdSNamhyung Kim node = rb_next(node); 175f8ebb0cdSNamhyung Kim } 176f8ebb0cdSNamhyung Kim 177f8ebb0cdSNamhyung Kim if (count != ARRAY_SIZE(fake_common_samples)) { 178f8ebb0cdSNamhyung Kim pr_debug("Invalid count for matched entries: %zd of %zd\n", 179f8ebb0cdSNamhyung Kim count, ARRAY_SIZE(fake_common_samples)); 180f8ebb0cdSNamhyung Kim return -1; 181f8ebb0cdSNamhyung Kim } 182f8ebb0cdSNamhyung Kim 183f8ebb0cdSNamhyung Kim return 0; 184f8ebb0cdSNamhyung Kim } 185f8ebb0cdSNamhyung Kim 186f8ebb0cdSNamhyung Kim static int validate_match(struct hists *leader, struct hists *other) 187f8ebb0cdSNamhyung Kim { 188f8ebb0cdSNamhyung Kim return __validate_match(leader) || __validate_match(other); 189f8ebb0cdSNamhyung Kim } 190f8ebb0cdSNamhyung Kim 191f8ebb0cdSNamhyung Kim static int __validate_link(struct hists *hists, int idx) 192f8ebb0cdSNamhyung Kim { 193f8ebb0cdSNamhyung Kim size_t count = 0; 194f8ebb0cdSNamhyung Kim size_t count_pair = 0; 195f8ebb0cdSNamhyung Kim size_t count_dummy = 0; 196f8ebb0cdSNamhyung Kim struct rb_root *root; 197f8ebb0cdSNamhyung Kim struct rb_node *node; 198f8ebb0cdSNamhyung Kim 199f8ebb0cdSNamhyung Kim /* 200f8ebb0cdSNamhyung Kim * Leader hists (idx = 0) will have dummy entries from other, 201f8ebb0cdSNamhyung Kim * and some entries will have no pair. However every entry 202f8ebb0cdSNamhyung Kim * in other hists should have (dummy) pair. 203f8ebb0cdSNamhyung Kim */ 204f8ebb0cdSNamhyung Kim if (sort__need_collapse) 205f8ebb0cdSNamhyung Kim root = &hists->entries_collapsed; 206f8ebb0cdSNamhyung Kim else 207f8ebb0cdSNamhyung Kim root = hists->entries_in; 208f8ebb0cdSNamhyung Kim 209f8ebb0cdSNamhyung Kim node = rb_first(root); 210f8ebb0cdSNamhyung Kim while (node) { 211f8ebb0cdSNamhyung Kim struct hist_entry *he; 212f8ebb0cdSNamhyung Kim 213f8ebb0cdSNamhyung Kim he = rb_entry(node, struct hist_entry, rb_node_in); 214f8ebb0cdSNamhyung Kim 215f8ebb0cdSNamhyung Kim if (hist_entry__has_pairs(he)) { 216f8ebb0cdSNamhyung Kim if (!find_sample(fake_common_samples, 217f8ebb0cdSNamhyung Kim ARRAY_SIZE(fake_common_samples), 218f8ebb0cdSNamhyung Kim he->thread, he->ms.map, he->ms.sym) && 219f8ebb0cdSNamhyung Kim !find_sample(fake_samples[idx], 220f8ebb0cdSNamhyung Kim ARRAY_SIZE(fake_samples[idx]), 221f8ebb0cdSNamhyung Kim he->thread, he->ms.map, he->ms.sym)) { 222f8ebb0cdSNamhyung Kim count_dummy++; 223f8ebb0cdSNamhyung Kim } 224f8ebb0cdSNamhyung Kim count_pair++; 225f8ebb0cdSNamhyung Kim } else if (idx) { 226f8ebb0cdSNamhyung Kim pr_debug("A entry from the other hists should have pair\n"); 227f8ebb0cdSNamhyung Kim return -1; 228f8ebb0cdSNamhyung Kim } 229f8ebb0cdSNamhyung Kim 230f8ebb0cdSNamhyung Kim count++; 231f8ebb0cdSNamhyung Kim node = rb_next(node); 232f8ebb0cdSNamhyung Kim } 233f8ebb0cdSNamhyung Kim 234f8ebb0cdSNamhyung Kim /* 235f8ebb0cdSNamhyung Kim * Note that we have a entry collapsed in the other (idx = 1) hists. 236f8ebb0cdSNamhyung Kim */ 237f8ebb0cdSNamhyung Kim if (idx == 0) { 238f8ebb0cdSNamhyung Kim if (count_dummy != ARRAY_SIZE(fake_samples[1]) - 1) { 239f8ebb0cdSNamhyung Kim pr_debug("Invalid count of dummy entries: %zd of %zd\n", 240f8ebb0cdSNamhyung Kim count_dummy, ARRAY_SIZE(fake_samples[1]) - 1); 241f8ebb0cdSNamhyung Kim return -1; 242f8ebb0cdSNamhyung Kim } 243f8ebb0cdSNamhyung Kim if (count != count_pair + ARRAY_SIZE(fake_samples[0])) { 244f8ebb0cdSNamhyung Kim pr_debug("Invalid count of total leader entries: %zd of %zd\n", 245f8ebb0cdSNamhyung Kim count, count_pair + ARRAY_SIZE(fake_samples[0])); 246f8ebb0cdSNamhyung Kim return -1; 247f8ebb0cdSNamhyung Kim } 248f8ebb0cdSNamhyung Kim } else { 249f8ebb0cdSNamhyung Kim if (count != count_pair) { 250f8ebb0cdSNamhyung Kim pr_debug("Invalid count of total other entries: %zd of %zd\n", 251f8ebb0cdSNamhyung Kim count, count_pair); 252f8ebb0cdSNamhyung Kim return -1; 253f8ebb0cdSNamhyung Kim } 254f8ebb0cdSNamhyung Kim if (count_dummy > 0) { 255f8ebb0cdSNamhyung Kim pr_debug("Other hists should not have dummy entries: %zd\n", 256f8ebb0cdSNamhyung Kim count_dummy); 257f8ebb0cdSNamhyung Kim return -1; 258f8ebb0cdSNamhyung Kim } 259f8ebb0cdSNamhyung Kim } 260f8ebb0cdSNamhyung Kim 261f8ebb0cdSNamhyung Kim return 0; 262f8ebb0cdSNamhyung Kim } 263f8ebb0cdSNamhyung Kim 264f8ebb0cdSNamhyung Kim static int validate_link(struct hists *leader, struct hists *other) 265f8ebb0cdSNamhyung Kim { 266f8ebb0cdSNamhyung Kim return __validate_link(leader, 0) || __validate_link(other, 1); 267f8ebb0cdSNamhyung Kim } 268f8ebb0cdSNamhyung Kim 269f8ebb0cdSNamhyung Kim static void print_hists(struct hists *hists) 270f8ebb0cdSNamhyung Kim { 271f8ebb0cdSNamhyung Kim int i = 0; 272f8ebb0cdSNamhyung Kim struct rb_root *root; 273f8ebb0cdSNamhyung Kim struct rb_node *node; 274f8ebb0cdSNamhyung Kim 275f8ebb0cdSNamhyung Kim if (sort__need_collapse) 276f8ebb0cdSNamhyung Kim root = &hists->entries_collapsed; 277f8ebb0cdSNamhyung Kim else 278f8ebb0cdSNamhyung Kim root = hists->entries_in; 279f8ebb0cdSNamhyung Kim 280f8ebb0cdSNamhyung Kim pr_info("----- %s --------\n", __func__); 281f8ebb0cdSNamhyung Kim node = rb_first(root); 282f8ebb0cdSNamhyung Kim while (node) { 283f8ebb0cdSNamhyung Kim struct hist_entry *he; 284f8ebb0cdSNamhyung Kim 285f8ebb0cdSNamhyung Kim he = rb_entry(node, struct hist_entry, rb_node_in); 286f8ebb0cdSNamhyung Kim 287f8ebb0cdSNamhyung Kim pr_info("%2d: entry: %-8s [%-8s] %20s: period = %"PRIu64"\n", 288b9c5143aSFrederic Weisbecker i, thread__comm_str(he->thread), he->ms.map->dso->short_name, 289f8ebb0cdSNamhyung Kim he->ms.sym->name, he->stat.period); 290f8ebb0cdSNamhyung Kim 291f8ebb0cdSNamhyung Kim i++; 292f8ebb0cdSNamhyung Kim node = rb_next(node); 293f8ebb0cdSNamhyung Kim } 294f8ebb0cdSNamhyung Kim } 295f8ebb0cdSNamhyung Kim 296f8ebb0cdSNamhyung Kim int test__hists_link(void) 297f8ebb0cdSNamhyung Kim { 298f8ebb0cdSNamhyung Kim int err = -1; 299876650e6SArnaldo Carvalho de Melo struct machines machines; 300f8ebb0cdSNamhyung Kim struct machine *machine = NULL; 301f8ebb0cdSNamhyung Kim struct perf_evsel *evsel, *first; 302334fe7a3SNamhyung Kim struct perf_evlist *evlist = perf_evlist__new(); 303f8ebb0cdSNamhyung Kim 304f8ebb0cdSNamhyung Kim if (evlist == NULL) 305f8ebb0cdSNamhyung Kim return -ENOMEM; 306f8ebb0cdSNamhyung Kim 307d8f7bbc9SJiri Olsa err = parse_events(evlist, "cpu-clock"); 308f8ebb0cdSNamhyung Kim if (err) 309f8ebb0cdSNamhyung Kim goto out; 310d8f7bbc9SJiri Olsa err = parse_events(evlist, "task-clock"); 311f8ebb0cdSNamhyung Kim if (err) 312f8ebb0cdSNamhyung Kim goto out; 313f8ebb0cdSNamhyung Kim 314f8ebb0cdSNamhyung Kim /* default sort order (comm,dso,sym) will be used */ 31555309985SNamhyung Kim if (setup_sorting() < 0) 31655309985SNamhyung Kim goto out; 317f8ebb0cdSNamhyung Kim 318876650e6SArnaldo Carvalho de Melo machines__init(&machines); 319876650e6SArnaldo Carvalho de Melo 320f8ebb0cdSNamhyung Kim /* setup threads/dso/map/symbols also */ 321876650e6SArnaldo Carvalho de Melo machine = setup_fake_machine(&machines); 322f8ebb0cdSNamhyung Kim if (!machine) 323f8ebb0cdSNamhyung Kim goto out; 324f8ebb0cdSNamhyung Kim 325f8ebb0cdSNamhyung Kim if (verbose > 1) 326f8ebb0cdSNamhyung Kim machine__fprintf(machine, stderr); 327f8ebb0cdSNamhyung Kim 328f8ebb0cdSNamhyung Kim /* process sample events */ 329f8ebb0cdSNamhyung Kim err = add_hist_entries(evlist, machine); 330f8ebb0cdSNamhyung Kim if (err < 0) 331f8ebb0cdSNamhyung Kim goto out; 332f8ebb0cdSNamhyung Kim 3330050f7aaSArnaldo Carvalho de Melo evlist__for_each(evlist, evsel) { 334c1fb5651SNamhyung Kim hists__collapse_resort(&evsel->hists, NULL); 335f8ebb0cdSNamhyung Kim 336f8ebb0cdSNamhyung Kim if (verbose > 2) 337f8ebb0cdSNamhyung Kim print_hists(&evsel->hists); 338f8ebb0cdSNamhyung Kim } 339f8ebb0cdSNamhyung Kim 340f8ebb0cdSNamhyung Kim first = perf_evlist__first(evlist); 341f8ebb0cdSNamhyung Kim evsel = perf_evlist__last(evlist); 342f8ebb0cdSNamhyung Kim 343f8ebb0cdSNamhyung Kim /* match common entries */ 344f8ebb0cdSNamhyung Kim hists__match(&first->hists, &evsel->hists); 345f8ebb0cdSNamhyung Kim err = validate_match(&first->hists, &evsel->hists); 346f8ebb0cdSNamhyung Kim if (err) 347f8ebb0cdSNamhyung Kim goto out; 348f8ebb0cdSNamhyung Kim 349f8ebb0cdSNamhyung Kim /* link common and/or dummy entries */ 350f8ebb0cdSNamhyung Kim hists__link(&first->hists, &evsel->hists); 351f8ebb0cdSNamhyung Kim err = validate_link(&first->hists, &evsel->hists); 352f8ebb0cdSNamhyung Kim if (err) 353f8ebb0cdSNamhyung Kim goto out; 354f8ebb0cdSNamhyung Kim 355f8ebb0cdSNamhyung Kim err = 0; 356f8ebb0cdSNamhyung Kim 357f8ebb0cdSNamhyung Kim out: 358f8ebb0cdSNamhyung Kim /* tear down everything */ 359f8ebb0cdSNamhyung Kim perf_evlist__delete(evlist); 360876650e6SArnaldo Carvalho de Melo machines__exit(&machines); 361f8ebb0cdSNamhyung Kim 362f8ebb0cdSNamhyung Kim return err; 363f8ebb0cdSNamhyung Kim } 364