diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-13 13:56:40 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-14 14:00:16 -0500 |
commit | d87fcb4a2d990ba2de9284ede84a816c5066d54b (patch) | |
tree | a9f5d05256aee5504d165941de88c88676a03b3f | |
parent | 9a354cdc2f40344a177d369fb4987a8270dd94df (diff) |
perf evsel: Introduce perf_evsel__prev() method
Just one use so far, on the hists browser, for completeness since there
we use perf_evlist__{first,last} and perf_evsel__next() for handling the
TAB and UNTAB keys.
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: Namhyung Kim <namhyung@kernel.org>
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-d09l4lejp5427enuf3igpckw@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 2 | ||||
-rw-r--r-- | tools/perf/util/evsel.h | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 089fd3713783..a440e03cd8c2 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -1855,7 +1855,7 @@ browse_hists: | |||
1855 | if (pos->node.prev == &evlist->entries) | 1855 | if (pos->node.prev == &evlist->entries) |
1856 | pos = perf_evlist__last(evlist); | 1856 | pos = perf_evlist__last(evlist); |
1857 | else | 1857 | else |
1858 | pos = list_entry(pos->node.prev, struct perf_evsel, node); | 1858 | pos = perf_evsel__prev(pos); |
1859 | goto browse_hists; | 1859 | goto browse_hists; |
1860 | case K_ESC: | 1860 | case K_ESC: |
1861 | if (!ui_browser__dialog_yesno(&menu->b, | 1861 | if (!ui_browser__dialog_yesno(&menu->b, |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index f5029653dcd7..1ea7c92e6e33 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -279,6 +279,11 @@ static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel) | |||
279 | return list_entry(evsel->node.next, struct perf_evsel, node); | 279 | return list_entry(evsel->node.next, struct perf_evsel, node); |
280 | } | 280 | } |
281 | 281 | ||
282 | static inline struct perf_evsel *perf_evsel__prev(struct perf_evsel *evsel) | ||
283 | { | ||
284 | return list_entry(evsel->node.prev, struct perf_evsel, node); | ||
285 | } | ||
286 | |||
282 | /** | 287 | /** |
283 | * perf_evsel__is_group_leader - Return whether given evsel is a leader event | 288 | * perf_evsel__is_group_leader - Return whether given evsel is a leader event |
284 | * | 289 | * |