Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0050f7aa authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent f6d8b057
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ static int __cmd_annotate(struct perf_annotate *ann)
		perf_session__fprintf_dsos(session, stdout);

	total_nr_samples = 0;
	list_for_each_entry(pos, &session->evlist->entries, node) {
	evlist__for_each(session->evlist, pos) {
		struct hists *hists = &pos->hists;
		u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE];

+4 −3
Original line number Diff line number Diff line
@@ -356,9 +356,10 @@ static struct perf_evsel *evsel_match(struct perf_evsel *evsel,
{
	struct perf_evsel *e;

	list_for_each_entry(e, &evlist->entries, node)
	evlist__for_each(evlist, e) {
		if (perf_evsel__match2(evsel, e))
			return e;
	}

	return NULL;
}
@@ -367,7 +368,7 @@ static void perf_evlist__collapse_resort(struct perf_evlist *evlist)
{
	struct perf_evsel *evsel;

	list_for_each_entry(evsel, &evlist->entries, node) {
	evlist__for_each(evlist, evsel) {
		struct hists *hists = &evsel->hists;

		hists__collapse_resort(hists, NULL);
@@ -614,7 +615,7 @@ static void data_process(void)
	struct perf_evsel *evsel_base;
	bool first = true;

	list_for_each_entry(evsel_base, &evlist_base->entries, node) {
	evlist__for_each(evlist_base, evsel_base) {
		struct data__file *d;
		int i;

+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ static int __cmd_evlist(const char *file_name, struct perf_attr_details *details
	if (session == NULL)
		return -ENOMEM;

	list_for_each_entry(pos, &session->evlist->entries, node)
	evlist__for_each(session->evlist, pos)
		perf_evsel__fprintf(pos, details, stdout);

	perf_session__delete(session);
+1 −1
Original line number Diff line number Diff line
@@ -369,7 +369,7 @@ static int __cmd_inject(struct perf_inject *inject)

		inject->tool.ordered_samples = true;

		list_for_each_entry(evsel, &session->evlist->entries, node) {
		evlist__for_each(session->evlist, evsel) {
			const char *name = perf_evsel__name(evsel);

			if (!strcmp(name, "sched:sched_switch")) {
+1 −1
Original line number Diff line number Diff line
@@ -1174,7 +1174,7 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm)
	 * Note: exclude_{guest,host} do not apply here.
	 *       This command processes KVM tracepoints from host only
	 */
	list_for_each_entry(pos, &evlist->entries, node) {
	evlist__for_each(evlist, pos) {
		struct perf_event_attr *attr = &pos->attr;

		/* make sure these *are* set */
Loading