Skip to content

Commit

Permalink
perf evsel: Introduce perf_evsel__prev() method
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Nov 14, 2013
1 parent 9a354cd commit d87fcb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tools/perf/ui/browsers/hists.c
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,7 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
if (pos->node.prev == &evlist->entries)
pos = perf_evlist__last(evlist);
else
pos = list_entry(pos->node.prev, struct perf_evsel, node);
pos = perf_evsel__prev(pos);
goto browse_hists;
case K_ESC:
if (!ui_browser__dialog_yesno(&menu->b,
Expand Down
5 changes: 5 additions & 0 deletions tools/perf/util/evsel.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel)
return list_entry(evsel->node.next, struct perf_evsel, node);
}

static inline struct perf_evsel *perf_evsel__prev(struct perf_evsel *evsel)
{
return list_entry(evsel->node.prev, struct perf_evsel, node);
}

/**
* perf_evsel__is_group_leader - Return whether given evsel is a leader event
*
Expand Down

0 comments on commit d87fcb4

Please sign in to comment.