diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-07 14:41:19 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-11 13:56:39 -0500 |
commit | ef503831d8d64e12c6dad5547875cfcd4c5d043c (patch) | |
tree | 6c41b275c13b663260eefb5166d2b0527faaaea8 /tools/perf/builtin-trace.c | |
parent | d53e57d039c323fe3a43630e9f729df48134e2c9 (diff) |
perf evsel: Remove idx parm from constructor
Most uses of the evsel constructor are followed by a call to
perf_evlist__add with an idex of evlist->nr_entries, so make rename
the current constructor to perf_evsel__new_idx and remove the need
for passing the constructor for the common case.
We still need the new_idx variant because the way groups are handled,
with evsel->nr_members holding the number of entries in an evlist,
partitioning the evlist into sublists inside a single linked list.
This asks for a clarifying refactoring, but for now simplify the non
parser cases, so that tool writers don't have to bother with evsel idx
setting.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-zy9tskx6jqm2rmw7468zze2a@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r-- | tools/perf/builtin-trace.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 329b7832b5da..68943cad70d4 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -149,10 +149,9 @@ static void perf_evsel__delete_priv(struct perf_evsel *evsel) | |||
149 | perf_evsel__delete(evsel); | 149 | perf_evsel__delete(evsel); |
150 | } | 150 | } |
151 | 151 | ||
152 | static struct perf_evsel *perf_evsel__syscall_newtp(const char *direction, | 152 | static struct perf_evsel *perf_evsel__syscall_newtp(const char *direction, void *handler) |
153 | void *handler, int idx) | ||
154 | { | 153 | { |
155 | struct perf_evsel *evsel = perf_evsel__newtp("raw_syscalls", direction, idx); | 154 | struct perf_evsel *evsel = perf_evsel__newtp("raw_syscalls", direction); |
156 | 155 | ||
157 | if (evsel) { | 156 | if (evsel) { |
158 | evsel->priv = malloc(sizeof(struct syscall_tp)); | 157 | evsel->priv = malloc(sizeof(struct syscall_tp)); |
@@ -186,17 +185,16 @@ static int perf_evlist__add_syscall_newtp(struct perf_evlist *evlist, | |||
186 | void *sys_exit_handler) | 185 | void *sys_exit_handler) |
187 | { | 186 | { |
188 | int ret = -1; | 187 | int ret = -1; |
189 | int idx = evlist->nr_entries; | ||
190 | struct perf_evsel *sys_enter, *sys_exit; | 188 | struct perf_evsel *sys_enter, *sys_exit; |
191 | 189 | ||
192 | sys_enter = perf_evsel__syscall_newtp("sys_enter", sys_enter_handler, idx++); | 190 | sys_enter = perf_evsel__syscall_newtp("sys_enter", sys_enter_handler); |
193 | if (sys_enter == NULL) | 191 | if (sys_enter == NULL) |
194 | goto out; | 192 | goto out; |
195 | 193 | ||
196 | if (perf_evsel__init_sc_tp_ptr_field(sys_enter, args)) | 194 | if (perf_evsel__init_sc_tp_ptr_field(sys_enter, args)) |
197 | goto out_delete_sys_enter; | 195 | goto out_delete_sys_enter; |
198 | 196 | ||
199 | sys_exit = perf_evsel__syscall_newtp("sys_exit", sys_exit_handler, idx++); | 197 | sys_exit = perf_evsel__syscall_newtp("sys_exit", sys_exit_handler); |
200 | if (sys_exit == NULL) | 198 | if (sys_exit == NULL) |
201 | goto out_delete_sys_enter; | 199 | goto out_delete_sys_enter; |
202 | 200 | ||
@@ -1824,8 +1822,7 @@ static size_t trace__fprintf_thread_summary(struct trace *trace, FILE *fp); | |||
1824 | 1822 | ||
1825 | static void perf_evlist__add_vfs_getname(struct perf_evlist *evlist) | 1823 | static void perf_evlist__add_vfs_getname(struct perf_evlist *evlist) |
1826 | { | 1824 | { |
1827 | struct perf_evsel *evsel = perf_evsel__newtp("probe", "vfs_getname", | 1825 | struct perf_evsel *evsel = perf_evsel__newtp("probe", "vfs_getname"); |
1828 | evlist->nr_entries); | ||
1829 | if (evsel == NULL) | 1826 | if (evsel == NULL) |
1830 | return; | 1827 | return; |
1831 | 1828 | ||