提交 334fe7a3 编写于 作者: N Namhyung Kim 提交者: Arnaldo Carvalho de Melo

perf evlist: Remove cpus and threads arguments from perf_evlist__new()

It's almost always used with NULL for both arguments.  Get rid of the
arguments from the signature and use perf_evlist__set_maps() if needed.
Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1362987798-24969-1-git-send-email-namhyung@kernel.org
[ committer note: replaced spaces with tabs in some of the affected lines ]
Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 b28b1307
...@@ -964,7 +964,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -964,7 +964,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
struct perf_record *rec = &record; struct perf_record *rec = &record;
char errbuf[BUFSIZ]; char errbuf[BUFSIZ];
evsel_list = perf_evlist__new(NULL, NULL); evsel_list = perf_evlist__new();
if (evsel_list == NULL) if (evsel_list == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -1336,7 +1336,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -1336,7 +1336,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
evsel_list = perf_evlist__new(NULL, NULL); evsel_list = perf_evlist__new();
if (evsel_list == NULL) if (evsel_list == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -1116,7 +1116,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -1116,7 +1116,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
NULL NULL
}; };
top.evlist = perf_evlist__new(NULL, NULL); top.evlist = perf_evlist__new();
if (top.evlist == NULL) if (top.evlist == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -419,7 +419,7 @@ static int trace__sched_stat_runtime(struct trace *trace, struct perf_evsel *evs ...@@ -419,7 +419,7 @@ static int trace__sched_stat_runtime(struct trace *trace, struct perf_evsel *evs
static int trace__run(struct trace *trace, int argc, const char **argv) static int trace__run(struct trace *trace, int argc, const char **argv)
{ {
struct perf_evlist *evlist = perf_evlist__new(NULL, NULL); struct perf_evlist *evlist = perf_evlist__new();
struct perf_evsel *evsel; struct perf_evsel *evsel;
int err = -1, i; int err = -1, i;
unsigned long before; unsigned long before;
......
...@@ -8,7 +8,7 @@ static int perf_evsel__roundtrip_cache_name_test(void) ...@@ -8,7 +8,7 @@ static int perf_evsel__roundtrip_cache_name_test(void)
char name[128]; char name[128];
int type, op, err = 0, ret = 0, i, idx; int type, op, err = 0, ret = 0, i, idx;
struct perf_evsel *evsel; struct perf_evsel *evsel;
struct perf_evlist *evlist = perf_evlist__new(NULL, NULL); struct perf_evlist *evlist = perf_evlist__new();
if (evlist == NULL) if (evlist == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -64,7 +64,7 @@ static int __perf_evsel__name_array_test(const char *names[], int nr_names) ...@@ -64,7 +64,7 @@ static int __perf_evsel__name_array_test(const char *names[], int nr_names)
{ {
int i, err; int i, err;
struct perf_evsel *evsel; struct perf_evsel *evsel;
struct perf_evlist *evlist = perf_evlist__new(NULL, NULL); struct perf_evlist *evlist = perf_evlist__new();
if (evlist == NULL) if (evlist == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -436,7 +436,7 @@ int test__hists_link(void) ...@@ -436,7 +436,7 @@ int test__hists_link(void)
struct machines machines; struct machines machines;
struct machine *machine = NULL; struct machine *machine = NULL;
struct perf_evsel *evsel, *first; struct perf_evsel *evsel, *first;
struct perf_evlist *evlist = perf_evlist__new(NULL, NULL); struct perf_evlist *evlist = perf_evlist__new();
if (evlist == NULL) if (evlist == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -53,12 +53,14 @@ int test__basic_mmap(void) ...@@ -53,12 +53,14 @@ int test__basic_mmap(void)
goto out_free_cpus; goto out_free_cpus;
} }
evlist = perf_evlist__new(cpus, threads); evlist = perf_evlist__new();
if (evlist == NULL) { if (evlist == NULL) {
pr_debug("perf_evlist__new\n"); pr_debug("perf_evlist__new\n");
goto out_free_cpus; goto out_free_cpus;
} }
perf_evlist__set_maps(evlist, cpus, threads);
for (i = 0; i < nsyscalls; ++i) { for (i = 0; i < nsyscalls; ++i) {
char name[64]; char name[64];
......
...@@ -18,7 +18,7 @@ int test__syscall_open_tp_fields(void) ...@@ -18,7 +18,7 @@ int test__syscall_open_tp_fields(void)
}; };
const char *filename = "/etc/passwd"; const char *filename = "/etc/passwd";
int flags = O_RDONLY | O_DIRECTORY; int flags = O_RDONLY | O_DIRECTORY;
struct perf_evlist *evlist = perf_evlist__new(NULL, NULL); struct perf_evlist *evlist = perf_evlist__new();
struct perf_evsel *evsel; struct perf_evsel *evsel;
int err = -1, i, nr_events = 0, nr_polls = 0; int err = -1, i, nr_events = 0, nr_polls = 0;
......
...@@ -1218,7 +1218,7 @@ static int test_event(struct evlist_test *e) ...@@ -1218,7 +1218,7 @@ static int test_event(struct evlist_test *e)
struct perf_evlist *evlist; struct perf_evlist *evlist;
int ret; int ret;
evlist = perf_evlist__new(NULL, NULL); evlist = perf_evlist__new();
if (evlist == NULL) if (evlist == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -45,7 +45,7 @@ int test__PERF_RECORD(void) ...@@ -45,7 +45,7 @@ int test__PERF_RECORD(void)
}; };
cpu_set_t cpu_mask; cpu_set_t cpu_mask;
size_t cpu_mask_size = sizeof(cpu_mask); size_t cpu_mask_size = sizeof(cpu_mask);
struct perf_evlist *evlist = perf_evlist__new(NULL, NULL); struct perf_evlist *evlist = perf_evlist__new();
struct perf_evsel *evsel; struct perf_evsel *evsel;
struct perf_sample sample; struct perf_sample sample;
const char *cmd = "sleep"; const char *cmd = "sleep";
......
...@@ -38,13 +38,12 @@ void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus, ...@@ -38,13 +38,12 @@ void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
evlist->workload.pid = -1; evlist->workload.pid = -1;
} }
struct perf_evlist *perf_evlist__new(struct cpu_map *cpus, struct perf_evlist *perf_evlist__new(void)
struct thread_map *threads)
{ {
struct perf_evlist *evlist = zalloc(sizeof(*evlist)); struct perf_evlist *evlist = zalloc(sizeof(*evlist));
if (evlist != NULL) if (evlist != NULL)
perf_evlist__init(evlist, cpus, threads); perf_evlist__init(evlist, NULL, NULL);
return evlist; return evlist;
} }
......
...@@ -49,8 +49,7 @@ struct perf_evsel_str_handler { ...@@ -49,8 +49,7 @@ struct perf_evsel_str_handler {
void *handler; void *handler;
}; };
struct perf_evlist *perf_evlist__new(struct cpu_map *cpus, struct perf_evlist *perf_evlist__new(void);
struct thread_map *threads);
void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus, void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
struct thread_map *threads); struct thread_map *threads);
void perf_evlist__exit(struct perf_evlist *evlist); void perf_evlist__exit(struct perf_evlist *evlist);
......
...@@ -2789,7 +2789,7 @@ int perf_session__read_header(struct perf_session *session, int fd) ...@@ -2789,7 +2789,7 @@ int perf_session__read_header(struct perf_session *session, int fd)
u64 f_id; u64 f_id;
int nr_attrs, nr_ids, i, j; int nr_attrs, nr_ids, i, j;
session->evlist = perf_evlist__new(NULL, NULL); session->evlist = perf_evlist__new();
if (session->evlist == NULL) if (session->evlist == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -2940,7 +2940,7 @@ int perf_event__process_attr(union perf_event *event, ...@@ -2940,7 +2940,7 @@ int perf_event__process_attr(union perf_event *event,
struct perf_evlist *evlist = *pevlist; struct perf_evlist *evlist = *pevlist;
if (evlist == NULL) { if (evlist == NULL) {
*pevlist = evlist = perf_evlist__new(NULL, NULL); *pevlist = evlist = perf_evlist__new();
if (evlist == NULL) if (evlist == NULL)
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册