diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2013-12-11 07:36:35 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-13 08:30:21 -0500 |
commit | a025e4f0d8a92b38539d39b495b530015296b4d9 (patch) | |
tree | 8e219d03a54173786f79871d1867ef2bf6c720a0 | |
parent | 8d00be815c05ed0f0202f606bab4e54f98fd3b30 (diff) |
perf evlist: Add perf_evlist__to_front()
Add a function to move a selected event to the
front of the list.
This is needed because it is not possible
to use the PERF_EVENT_IOC_SET_OUTPUT IOCTL
from an Instruction Tracing event to a
non-Instruction Tracing event. Thus the
Instruction Tracing event must come first.
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1386765443-26966-24-git-send-email-alexander.shishkin@linux.intel.com
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/evlist.c | 17 | ||||
-rw-r--r-- | tools/perf/util/evlist.h | 3 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 2eb7378e4c40..0b31cee34874 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -1212,3 +1212,20 @@ int perf_evlist__strerror_open(struct perf_evlist *evlist __maybe_unused, | |||
1212 | 1212 | ||
1213 | return 0; | 1213 | return 0; |
1214 | } | 1214 | } |
1215 | |||
1216 | void perf_evlist__to_front(struct perf_evlist *evlist, | ||
1217 | struct perf_evsel *move_evsel) | ||
1218 | { | ||
1219 | struct perf_evsel *evsel, *n; | ||
1220 | LIST_HEAD(move); | ||
1221 | |||
1222 | if (move_evsel == perf_evlist__first(evlist)) | ||
1223 | return; | ||
1224 | |||
1225 | list_for_each_entry_safe(evsel, n, &evlist->entries, node) { | ||
1226 | if (evsel->leader == move_evsel->leader) | ||
1227 | list_move_tail(&evsel->node, &move); | ||
1228 | } | ||
1229 | |||
1230 | list_splice(&move, &evlist->entries); | ||
1231 | } | ||
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index 8a04aae95a18..9f64ede3ecbd 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -194,5 +194,8 @@ static inline void perf_mmap__write_tail(struct perf_mmap *md, | |||
194 | } | 194 | } |
195 | 195 | ||
196 | bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str); | 196 | bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str); |
197 | void perf_evlist__to_front(struct perf_evlist *evlist, | ||
198 | struct perf_evsel *move_evsel); | ||
199 | |||
197 | 200 | ||
198 | #endif /* __PERF_EVLIST_H */ | 201 | #endif /* __PERF_EVLIST_H */ |