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" 116e344a95SNamhyung 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 216e344a95SNamhyung Kim /* For the numbers, see hists_common.c */ 22f8ebb0cdSNamhyung Kim static struct sample fake_common_samples[] = { 23f8ebb0cdSNamhyung Kim /* perf [kernel] schedule() */ 24a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF1, .ip = FAKE_IP_KERNEL_SCHEDULE, }, 25f8ebb0cdSNamhyung Kim /* perf [perf] main() */ 26a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF2, .ip = FAKE_IP_PERF_MAIN, }, 27f8ebb0cdSNamhyung Kim /* perf [perf] cmd_record() */ 28a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF2, .ip = FAKE_IP_PERF_CMD_RECORD, }, 29f8ebb0cdSNamhyung Kim /* bash [bash] xmalloc() */ 30a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_BASH_XMALLOC, }, 31f8ebb0cdSNamhyung Kim /* bash [libc] malloc() */ 32a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_LIBC_MALLOC, }, 33f8ebb0cdSNamhyung Kim }; 34f8ebb0cdSNamhyung Kim 35f8ebb0cdSNamhyung Kim static struct sample fake_samples[][5] = { 36f8ebb0cdSNamhyung Kim { 37f8ebb0cdSNamhyung Kim /* perf [perf] run_command() */ 38a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF1, .ip = FAKE_IP_PERF_RUN_COMMAND, }, 39f8ebb0cdSNamhyung Kim /* perf [libc] malloc() */ 40a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF1, .ip = FAKE_IP_LIBC_MALLOC, }, 41f8ebb0cdSNamhyung Kim /* perf [kernel] page_fault() */ 42a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF1, .ip = FAKE_IP_KERNEL_PAGE_FAULT, }, 43f8ebb0cdSNamhyung Kim /* perf [kernel] sys_perf_event_open() */ 44a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF2, .ip = FAKE_IP_KERNEL_SYS_PERF_EVENT_OPEN, }, 45f8ebb0cdSNamhyung Kim /* bash [libc] free() */ 46a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_LIBC_FREE, }, 47f8ebb0cdSNamhyung Kim }, 48f8ebb0cdSNamhyung Kim { 49f8ebb0cdSNamhyung Kim /* perf [libc] free() */ 50a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF2, .ip = FAKE_IP_LIBC_FREE, }, 51f8ebb0cdSNamhyung Kim /* bash [libc] malloc() */ 52a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_LIBC_MALLOC, }, /* will be merged */ 53f8ebb0cdSNamhyung Kim /* bash [bash] xfee() */ 54a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_BASH_XFREE, }, 55f8ebb0cdSNamhyung Kim /* bash [libc] realloc() */ 56a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_LIBC_REALLOC, }, 57f8ebb0cdSNamhyung Kim /* bash [kernel] page_fault() */ 58a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_KERNEL_PAGE_FAULT, }, 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; 67*fd36f3ddSNamhyung Kim struct perf_sample sample = { .period = 1, .weight = 1, }; 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) { 764ea062edSArnaldo Carvalho de Melo struct hists *hists = evsel__hists(evsel); 774ea062edSArnaldo Carvalho de Melo 78f8ebb0cdSNamhyung Kim for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) { 79f8ebb0cdSNamhyung Kim const union perf_event event = { 80f8ebb0cdSNamhyung Kim .header = { 81f8ebb0cdSNamhyung Kim .misc = PERF_RECORD_MISC_USER, 82f8ebb0cdSNamhyung Kim }, 83f8ebb0cdSNamhyung Kim }; 84f8ebb0cdSNamhyung Kim 85ef89325fSAdrian Hunter sample.pid = fake_common_samples[k].pid; 8613ce34dfSNamhyung Kim sample.tid = fake_common_samples[k].pid; 87ef89325fSAdrian Hunter sample.ip = fake_common_samples[k].ip; 88f8ebb0cdSNamhyung Kim if (perf_event__preprocess_sample(&event, machine, &al, 89e44baa3eSAdrian Hunter &sample) < 0) 90f8ebb0cdSNamhyung Kim goto out; 91f8ebb0cdSNamhyung Kim 924ea062edSArnaldo Carvalho de Melo he = __hists__add_entry(hists, &al, NULL, 93*fd36f3ddSNamhyung Kim NULL, NULL, &sample, true); 94b91fc39fSArnaldo Carvalho de Melo if (he == NULL) { 95b91fc39fSArnaldo Carvalho de Melo addr_location__put(&al); 96f8ebb0cdSNamhyung Kim goto out; 97b91fc39fSArnaldo Carvalho de Melo } 98f8ebb0cdSNamhyung Kim 99f8ebb0cdSNamhyung Kim fake_common_samples[k].thread = al.thread; 100f8ebb0cdSNamhyung Kim fake_common_samples[k].map = al.map; 101f8ebb0cdSNamhyung Kim fake_common_samples[k].sym = al.sym; 102f8ebb0cdSNamhyung Kim } 103f8ebb0cdSNamhyung Kim 104f8ebb0cdSNamhyung Kim for (k = 0; k < ARRAY_SIZE(fake_samples[i]); k++) { 105f8ebb0cdSNamhyung Kim const union perf_event event = { 106f8ebb0cdSNamhyung Kim .header = { 107f8ebb0cdSNamhyung Kim .misc = PERF_RECORD_MISC_USER, 108f8ebb0cdSNamhyung Kim }, 109f8ebb0cdSNamhyung Kim }; 110f8ebb0cdSNamhyung Kim 111ef89325fSAdrian Hunter sample.pid = fake_samples[i][k].pid; 11213ce34dfSNamhyung Kim sample.tid = fake_samples[i][k].pid; 113ef89325fSAdrian Hunter sample.ip = fake_samples[i][k].ip; 114f8ebb0cdSNamhyung Kim if (perf_event__preprocess_sample(&event, machine, &al, 115e44baa3eSAdrian Hunter &sample) < 0) 116f8ebb0cdSNamhyung Kim goto out; 117f8ebb0cdSNamhyung Kim 1184ea062edSArnaldo Carvalho de Melo he = __hists__add_entry(hists, &al, NULL, 119*fd36f3ddSNamhyung Kim NULL, NULL, &sample, true); 120b91fc39fSArnaldo Carvalho de Melo if (he == NULL) { 121b91fc39fSArnaldo Carvalho de Melo addr_location__put(&al); 122f8ebb0cdSNamhyung Kim goto out; 123b91fc39fSArnaldo Carvalho de Melo } 124f8ebb0cdSNamhyung Kim 125f8ebb0cdSNamhyung Kim fake_samples[i][k].thread = al.thread; 126f8ebb0cdSNamhyung Kim fake_samples[i][k].map = al.map; 127f8ebb0cdSNamhyung Kim fake_samples[i][k].sym = al.sym; 128f8ebb0cdSNamhyung Kim } 129f8ebb0cdSNamhyung Kim i++; 130f8ebb0cdSNamhyung Kim } 131f8ebb0cdSNamhyung Kim 132f8ebb0cdSNamhyung Kim return 0; 133f8ebb0cdSNamhyung Kim 134f8ebb0cdSNamhyung Kim out: 135f8ebb0cdSNamhyung Kim pr_debug("Not enough memory for adding a hist entry\n"); 136f8ebb0cdSNamhyung Kim return -1; 137f8ebb0cdSNamhyung Kim } 138f8ebb0cdSNamhyung Kim 139f8ebb0cdSNamhyung Kim static int find_sample(struct sample *samples, size_t nr_samples, 140f8ebb0cdSNamhyung Kim struct thread *t, struct map *m, struct symbol *s) 141f8ebb0cdSNamhyung Kim { 142f8ebb0cdSNamhyung Kim while (nr_samples--) { 143f8ebb0cdSNamhyung Kim if (samples->thread == t && samples->map == m && 144f8ebb0cdSNamhyung Kim samples->sym == s) 145f8ebb0cdSNamhyung Kim return 1; 146f8ebb0cdSNamhyung Kim samples++; 147f8ebb0cdSNamhyung Kim } 148f8ebb0cdSNamhyung Kim return 0; 149f8ebb0cdSNamhyung Kim } 150f8ebb0cdSNamhyung Kim 151f8ebb0cdSNamhyung Kim static int __validate_match(struct hists *hists) 152f8ebb0cdSNamhyung Kim { 153f8ebb0cdSNamhyung Kim size_t count = 0; 154f8ebb0cdSNamhyung Kim struct rb_root *root; 155f8ebb0cdSNamhyung Kim struct rb_node *node; 156f8ebb0cdSNamhyung Kim 157f8ebb0cdSNamhyung Kim /* 158f8ebb0cdSNamhyung Kim * Only entries from fake_common_samples should have a pair. 159f8ebb0cdSNamhyung Kim */ 160f8ebb0cdSNamhyung Kim if (sort__need_collapse) 161f8ebb0cdSNamhyung Kim root = &hists->entries_collapsed; 162f8ebb0cdSNamhyung Kim else 163f8ebb0cdSNamhyung Kim root = hists->entries_in; 164f8ebb0cdSNamhyung Kim 165f8ebb0cdSNamhyung Kim node = rb_first(root); 166f8ebb0cdSNamhyung Kim while (node) { 167f8ebb0cdSNamhyung Kim struct hist_entry *he; 168f8ebb0cdSNamhyung Kim 169f8ebb0cdSNamhyung Kim he = rb_entry(node, struct hist_entry, rb_node_in); 170f8ebb0cdSNamhyung Kim 171f8ebb0cdSNamhyung Kim if (hist_entry__has_pairs(he)) { 172f8ebb0cdSNamhyung Kim if (find_sample(fake_common_samples, 173f8ebb0cdSNamhyung Kim ARRAY_SIZE(fake_common_samples), 174f8ebb0cdSNamhyung Kim he->thread, he->ms.map, he->ms.sym)) { 175f8ebb0cdSNamhyung Kim count++; 176f8ebb0cdSNamhyung Kim } else { 177f8ebb0cdSNamhyung Kim pr_debug("Can't find the matched entry\n"); 178f8ebb0cdSNamhyung Kim return -1; 179f8ebb0cdSNamhyung Kim } 180f8ebb0cdSNamhyung Kim } 181f8ebb0cdSNamhyung Kim 182f8ebb0cdSNamhyung Kim node = rb_next(node); 183f8ebb0cdSNamhyung Kim } 184f8ebb0cdSNamhyung Kim 185f8ebb0cdSNamhyung Kim if (count != ARRAY_SIZE(fake_common_samples)) { 186f8ebb0cdSNamhyung Kim pr_debug("Invalid count for matched entries: %zd of %zd\n", 187f8ebb0cdSNamhyung Kim count, ARRAY_SIZE(fake_common_samples)); 188f8ebb0cdSNamhyung Kim return -1; 189f8ebb0cdSNamhyung Kim } 190f8ebb0cdSNamhyung Kim 191f8ebb0cdSNamhyung Kim return 0; 192f8ebb0cdSNamhyung Kim } 193f8ebb0cdSNamhyung Kim 194f8ebb0cdSNamhyung Kim static int validate_match(struct hists *leader, struct hists *other) 195f8ebb0cdSNamhyung Kim { 196f8ebb0cdSNamhyung Kim return __validate_match(leader) || __validate_match(other); 197f8ebb0cdSNamhyung Kim } 198f8ebb0cdSNamhyung Kim 199f8ebb0cdSNamhyung Kim static int __validate_link(struct hists *hists, int idx) 200f8ebb0cdSNamhyung Kim { 201f8ebb0cdSNamhyung Kim size_t count = 0; 202f8ebb0cdSNamhyung Kim size_t count_pair = 0; 203f8ebb0cdSNamhyung Kim size_t count_dummy = 0; 204f8ebb0cdSNamhyung Kim struct rb_root *root; 205f8ebb0cdSNamhyung Kim struct rb_node *node; 206f8ebb0cdSNamhyung Kim 207f8ebb0cdSNamhyung Kim /* 208f8ebb0cdSNamhyung Kim * Leader hists (idx = 0) will have dummy entries from other, 209f8ebb0cdSNamhyung Kim * and some entries will have no pair. However every entry 210f8ebb0cdSNamhyung Kim * in other hists should have (dummy) pair. 211f8ebb0cdSNamhyung Kim */ 212f8ebb0cdSNamhyung Kim if (sort__need_collapse) 213f8ebb0cdSNamhyung Kim root = &hists->entries_collapsed; 214f8ebb0cdSNamhyung Kim else 215f8ebb0cdSNamhyung Kim root = hists->entries_in; 216f8ebb0cdSNamhyung Kim 217f8ebb0cdSNamhyung Kim node = rb_first(root); 218f8ebb0cdSNamhyung Kim while (node) { 219f8ebb0cdSNamhyung Kim struct hist_entry *he; 220f8ebb0cdSNamhyung Kim 221f8ebb0cdSNamhyung Kim he = rb_entry(node, struct hist_entry, rb_node_in); 222f8ebb0cdSNamhyung Kim 223f8ebb0cdSNamhyung Kim if (hist_entry__has_pairs(he)) { 224f8ebb0cdSNamhyung Kim if (!find_sample(fake_common_samples, 225f8ebb0cdSNamhyung Kim ARRAY_SIZE(fake_common_samples), 226f8ebb0cdSNamhyung Kim he->thread, he->ms.map, he->ms.sym) && 227f8ebb0cdSNamhyung Kim !find_sample(fake_samples[idx], 228f8ebb0cdSNamhyung Kim ARRAY_SIZE(fake_samples[idx]), 229f8ebb0cdSNamhyung Kim he->thread, he->ms.map, he->ms.sym)) { 230f8ebb0cdSNamhyung Kim count_dummy++; 231f8ebb0cdSNamhyung Kim } 232f8ebb0cdSNamhyung Kim count_pair++; 233f8ebb0cdSNamhyung Kim } else if (idx) { 234f8ebb0cdSNamhyung Kim pr_debug("A entry from the other hists should have pair\n"); 235f8ebb0cdSNamhyung Kim return -1; 236f8ebb0cdSNamhyung Kim } 237f8ebb0cdSNamhyung Kim 238f8ebb0cdSNamhyung Kim count++; 239f8ebb0cdSNamhyung Kim node = rb_next(node); 240f8ebb0cdSNamhyung Kim } 241f8ebb0cdSNamhyung Kim 242f8ebb0cdSNamhyung Kim /* 243f8ebb0cdSNamhyung Kim * Note that we have a entry collapsed in the other (idx = 1) hists. 244f8ebb0cdSNamhyung Kim */ 245f8ebb0cdSNamhyung Kim if (idx == 0) { 246f8ebb0cdSNamhyung Kim if (count_dummy != ARRAY_SIZE(fake_samples[1]) - 1) { 247f8ebb0cdSNamhyung Kim pr_debug("Invalid count of dummy entries: %zd of %zd\n", 248f8ebb0cdSNamhyung Kim count_dummy, ARRAY_SIZE(fake_samples[1]) - 1); 249f8ebb0cdSNamhyung Kim return -1; 250f8ebb0cdSNamhyung Kim } 251f8ebb0cdSNamhyung Kim if (count != count_pair + ARRAY_SIZE(fake_samples[0])) { 252f8ebb0cdSNamhyung Kim pr_debug("Invalid count of total leader entries: %zd of %zd\n", 253f8ebb0cdSNamhyung Kim count, count_pair + ARRAY_SIZE(fake_samples[0])); 254f8ebb0cdSNamhyung Kim return -1; 255f8ebb0cdSNamhyung Kim } 256f8ebb0cdSNamhyung Kim } else { 257f8ebb0cdSNamhyung Kim if (count != count_pair) { 258f8ebb0cdSNamhyung Kim pr_debug("Invalid count of total other entries: %zd of %zd\n", 259f8ebb0cdSNamhyung Kim count, count_pair); 260f8ebb0cdSNamhyung Kim return -1; 261f8ebb0cdSNamhyung Kim } 262f8ebb0cdSNamhyung Kim if (count_dummy > 0) { 263f8ebb0cdSNamhyung Kim pr_debug("Other hists should not have dummy entries: %zd\n", 264f8ebb0cdSNamhyung Kim count_dummy); 265f8ebb0cdSNamhyung Kim return -1; 266f8ebb0cdSNamhyung Kim } 267f8ebb0cdSNamhyung Kim } 268f8ebb0cdSNamhyung Kim 269f8ebb0cdSNamhyung Kim return 0; 270f8ebb0cdSNamhyung Kim } 271f8ebb0cdSNamhyung Kim 272f8ebb0cdSNamhyung Kim static int validate_link(struct hists *leader, struct hists *other) 273f8ebb0cdSNamhyung Kim { 274f8ebb0cdSNamhyung Kim return __validate_link(leader, 0) || __validate_link(other, 1); 275f8ebb0cdSNamhyung Kim } 276f8ebb0cdSNamhyung Kim 277721a1f53SArnaldo Carvalho de Melo int test__hists_link(int subtest __maybe_unused) 278f8ebb0cdSNamhyung Kim { 279f8ebb0cdSNamhyung Kim int err = -1; 2804ea062edSArnaldo Carvalho de Melo struct hists *hists, *first_hists; 281876650e6SArnaldo Carvalho de Melo struct machines machines; 282f8ebb0cdSNamhyung Kim struct machine *machine = NULL; 283f8ebb0cdSNamhyung Kim struct perf_evsel *evsel, *first; 284334fe7a3SNamhyung Kim struct perf_evlist *evlist = perf_evlist__new(); 285f8ebb0cdSNamhyung Kim 286f8ebb0cdSNamhyung Kim if (evlist == NULL) 287f8ebb0cdSNamhyung Kim return -ENOMEM; 288f8ebb0cdSNamhyung Kim 289b39b8393SJiri Olsa err = parse_events(evlist, "cpu-clock", NULL); 290f8ebb0cdSNamhyung Kim if (err) 291f8ebb0cdSNamhyung Kim goto out; 292b39b8393SJiri Olsa err = parse_events(evlist, "task-clock", NULL); 293f8ebb0cdSNamhyung Kim if (err) 294f8ebb0cdSNamhyung Kim goto out; 295f8ebb0cdSNamhyung Kim 296f8ebb0cdSNamhyung Kim /* default sort order (comm,dso,sym) will be used */ 29755309985SNamhyung Kim if (setup_sorting() < 0) 29855309985SNamhyung Kim goto out; 299f8ebb0cdSNamhyung Kim 300876650e6SArnaldo Carvalho de Melo machines__init(&machines); 301876650e6SArnaldo Carvalho de Melo 302f8ebb0cdSNamhyung Kim /* setup threads/dso/map/symbols also */ 303876650e6SArnaldo Carvalho de Melo machine = setup_fake_machine(&machines); 304f8ebb0cdSNamhyung Kim if (!machine) 305f8ebb0cdSNamhyung Kim goto out; 306f8ebb0cdSNamhyung Kim 307f8ebb0cdSNamhyung Kim if (verbose > 1) 308f8ebb0cdSNamhyung Kim machine__fprintf(machine, stderr); 309f8ebb0cdSNamhyung Kim 310f8ebb0cdSNamhyung Kim /* process sample events */ 311f8ebb0cdSNamhyung Kim err = add_hist_entries(evlist, machine); 312f8ebb0cdSNamhyung Kim if (err < 0) 313f8ebb0cdSNamhyung Kim goto out; 314f8ebb0cdSNamhyung Kim 3150050f7aaSArnaldo Carvalho de Melo evlist__for_each(evlist, evsel) { 3164ea062edSArnaldo Carvalho de Melo hists = evsel__hists(evsel); 3174ea062edSArnaldo Carvalho de Melo hists__collapse_resort(hists, NULL); 318f8ebb0cdSNamhyung Kim 319f8ebb0cdSNamhyung Kim if (verbose > 2) 3204ea062edSArnaldo Carvalho de Melo print_hists_in(hists); 321f8ebb0cdSNamhyung Kim } 322f8ebb0cdSNamhyung Kim 323f8ebb0cdSNamhyung Kim first = perf_evlist__first(evlist); 324f8ebb0cdSNamhyung Kim evsel = perf_evlist__last(evlist); 325f8ebb0cdSNamhyung Kim 3264ea062edSArnaldo Carvalho de Melo first_hists = evsel__hists(first); 3274ea062edSArnaldo Carvalho de Melo hists = evsel__hists(evsel); 3284ea062edSArnaldo Carvalho de Melo 329f8ebb0cdSNamhyung Kim /* match common entries */ 3304ea062edSArnaldo Carvalho de Melo hists__match(first_hists, hists); 3314ea062edSArnaldo Carvalho de Melo err = validate_match(first_hists, hists); 332f8ebb0cdSNamhyung Kim if (err) 333f8ebb0cdSNamhyung Kim goto out; 334f8ebb0cdSNamhyung Kim 335f8ebb0cdSNamhyung Kim /* link common and/or dummy entries */ 3364ea062edSArnaldo Carvalho de Melo hists__link(first_hists, hists); 3374ea062edSArnaldo Carvalho de Melo err = validate_link(first_hists, hists); 338f8ebb0cdSNamhyung Kim if (err) 339f8ebb0cdSNamhyung Kim goto out; 340f8ebb0cdSNamhyung Kim 341f8ebb0cdSNamhyung Kim err = 0; 342f8ebb0cdSNamhyung Kim 343f8ebb0cdSNamhyung Kim out: 344f8ebb0cdSNamhyung Kim /* tear down everything */ 345f8ebb0cdSNamhyung Kim perf_evlist__delete(evlist); 346f21d1815SNamhyung Kim reset_output_field(); 347876650e6SArnaldo Carvalho de Melo machines__exit(&machines); 348f8ebb0cdSNamhyung Kim 349f8ebb0cdSNamhyung Kim return err; 350f8ebb0cdSNamhyung Kim } 351