perf evlist: Introduce evlist__for_each() & friends
For the common evsel list traversal, so that it becomes more compact. Use the opportunity to start ditching the 'perf_' from 'perf_evlist__', as discussed, as the whole conversion touches a lot of places, lets do it piecemeal when we have the chance due to other work, like in this case. 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-qnkx7dzm2h6m6uptkfk03ni6@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -1938,7 +1938,7 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist,
|
||||
|
||||
ui_helpline__push("Press ESC to exit");
|
||||
|
||||
list_for_each_entry(pos, &evlist->entries, node) {
|
||||
evlist__for_each(evlist, pos) {
|
||||
const char *ev_name = perf_evsel__name(pos);
|
||||
size_t line_len = strlen(ev_name) + 7;
|
||||
|
||||
@@ -1970,9 +1970,10 @@ single_entry:
|
||||
struct perf_evsel *pos;
|
||||
|
||||
nr_entries = 0;
|
||||
list_for_each_entry(pos, &evlist->entries, node)
|
||||
evlist__for_each(evlist, pos) {
|
||||
if (perf_evsel__is_group_leader(pos))
|
||||
nr_entries++;
|
||||
}
|
||||
|
||||
if (nr_entries == 1)
|
||||
goto single_entry;
|
||||
|
Reference in New Issue
Block a user