evlist.c (52c86bca94b42239563b1510d5fc6329b0ec1a86) evlist.c (0f98b11c616f240b54ee85629ff4d3650c7ccc7d)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2011, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
4 *
5 * Parts came from builtin-{top,stat,record}.c, see those files for further
6 * copyright notes.
7 */
8#include <api/fs/fs.h>

--- 41 unchanged lines hidden (view full) ---

50 INIT_HLIST_HEAD(&evlist->heads[i]);
51 INIT_LIST_HEAD(&evlist->entries);
52 perf_evlist__set_maps(evlist, cpus, threads);
53 fdarray__init(&evlist->pollfd, 64);
54 evlist->workload.pid = -1;
55 evlist->bkw_mmap_state = BKW_MMAP_NOTREADY;
56}
57
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2011, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
4 *
5 * Parts came from builtin-{top,stat,record}.c, see those files for further
6 * copyright notes.
7 */
8#include <api/fs/fs.h>

--- 41 unchanged lines hidden (view full) ---

50 INIT_HLIST_HEAD(&evlist->heads[i]);
51 INIT_LIST_HEAD(&evlist->entries);
52 perf_evlist__set_maps(evlist, cpus, threads);
53 fdarray__init(&evlist->pollfd, 64);
54 evlist->workload.pid = -1;
55 evlist->bkw_mmap_state = BKW_MMAP_NOTREADY;
56}
57
58struct evlist *perf_evlist__new(void)
58struct evlist *evlist__new(void)
59{
60 struct evlist *evlist = zalloc(sizeof(*evlist));
61
62 if (evlist != NULL)
63 evlist__init(evlist, NULL, NULL);
64
65 return evlist;
66}
67
68struct evlist *perf_evlist__new_default(void)
69{
59{
60 struct evlist *evlist = zalloc(sizeof(*evlist));
61
62 if (evlist != NULL)
63 evlist__init(evlist, NULL, NULL);
64
65 return evlist;
66}
67
68struct evlist *perf_evlist__new_default(void)
69{
70 struct evlist *evlist = perf_evlist__new();
70 struct evlist *evlist = evlist__new();
71
72 if (evlist && perf_evlist__add_default(evlist)) {
73 perf_evlist__delete(evlist);
74 evlist = NULL;
75 }
76
77 return evlist;
78}
79
80struct evlist *perf_evlist__new_dummy(void)
81{
71
72 if (evlist && perf_evlist__add_default(evlist)) {
73 perf_evlist__delete(evlist);
74 evlist = NULL;
75 }
76
77 return evlist;
78}
79
80struct evlist *perf_evlist__new_dummy(void)
81{
82 struct evlist *evlist = perf_evlist__new();
82 struct evlist *evlist = evlist__new();
83
84 if (evlist && perf_evlist__add_dummy(evlist)) {
85 perf_evlist__delete(evlist);
86 evlist = NULL;
87 }
88
89 return evlist;
90}

--- 1743 unchanged lines hidden (view full) ---

1834 struct perf_event_attr *attr,
1835 perf_evsel__sb_cb_t cb,
1836 void *data)
1837{
1838 struct evsel *evsel;
1839 bool new_evlist = (*evlist) == NULL;
1840
1841 if (*evlist == NULL)
83
84 if (evlist && perf_evlist__add_dummy(evlist)) {
85 perf_evlist__delete(evlist);
86 evlist = NULL;
87 }
88
89 return evlist;
90}

--- 1743 unchanged lines hidden (view full) ---

1834 struct perf_event_attr *attr,
1835 perf_evsel__sb_cb_t cb,
1836 void *data)
1837{
1838 struct evsel *evsel;
1839 bool new_evlist = (*evlist) == NULL;
1840
1841 if (*evlist == NULL)
1842 *evlist = perf_evlist__new();
1842 *evlist = evlist__new();
1843 if (*evlist == NULL)
1844 return -1;
1845
1846 if (!attr->sample_id_all) {
1847 pr_warning("enabling sample_id_all for all side band events\n");
1848 attr->sample_id_all = 1;
1849 }
1850

--- 103 unchanged lines hidden ---
1843 if (*evlist == NULL)
1844 return -1;
1845
1846 if (!attr->sample_id_all) {
1847 pr_warning("enabling sample_id_all for all side band events\n");
1848 attr->sample_id_all = 1;
1849 }
1850

--- 103 unchanged lines hidden ---