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

Commit 7289f83c authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf tools: Move all users of event_name to perf_evsel__name

So that we don't use global variables that could make us misreport event
names when having a multi window top, for instance.

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@gmail.com>
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-mccancovi1u0wdkg8ncth509@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent a4460836
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ static int __cmd_evlist(const char *input_name, struct perf_attr_details *detail
	list_for_each_entry(pos, &session->evlist->entries, node) {
		bool first = true;

		printf("%s", event_name(pos));
		printf("%s", perf_evsel__name(pos));

		if (details->verbose || details->freq) {
			comma_printf(&first, " sample_freq=%" PRIu64,
+2 −2
Original line number Diff line number Diff line
@@ -265,7 +265,7 @@ static void perf_record__open(struct perf_record *rec)

			if (err == ENOENT) {
				ui__error("The %s event is not supported.\n",
					    event_name(pos));
					  perf_evsel__name(pos));
				exit(EXIT_FAILURE);
			}

@@ -916,7 +916,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
		usage_with_options(record_usage, record_options);

	list_for_each_entry(pos, &evsel_list->entries, node) {
		if (perf_header__push_event(pos->attr.config, event_name(pos)))
		if (perf_header__push_event(pos->attr.config, perf_evsel__name(pos)))
			goto out_free_fd;
	}

+3 −3
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ static int process_read_event(struct perf_tool *tool,
	struct perf_report *rep = container_of(tool, struct perf_report, tool);

	if (rep->show_threads) {
		const char *name = evsel ? event_name(evsel) : "unknown";
		const char *name = evsel ? perf_evsel__name(evsel) : "unknown";
		perf_read_values_add_value(&rep->show_threads_values,
					   event->read.pid, event->read.tid,
					   event->read.id,
@@ -239,7 +239,7 @@ static int process_read_event(struct perf_tool *tool,
	}

	dump_printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid,
		    evsel ? event_name(evsel) : "FAIL",
		    evsel ? perf_evsel__name(evsel) : "FAIL",
		    event->read.value);

	return 0;
@@ -314,7 +314,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,

	list_for_each_entry(pos, &evlist->entries, node) {
		struct hists *hists = &pos->hists;
		const char *evname = event_name(pos);
		const char *evname = perf_evsel__name(pos);

		hists__fprintf_nr_sample_events(hists, evname, stdout);
		hists__fprintf(hists, NULL, false, true, 0, 0, stdout);
+6 −6
Original line number Diff line number Diff line
@@ -391,7 +391,7 @@ static int read_counter_aggr(struct perf_evsel *counter)

	if (verbose) {
		fprintf(output, "%s: %" PRIu64 " %" PRIu64 " %" PRIu64 "\n",
			event_name(counter), count[0], count[1], count[2]);
			perf_evsel__name(counter), count[0], count[1], count[2]);
	}

	/*
@@ -496,7 +496,7 @@ static int run_perf_stat(int argc __used, const char **argv)
			    errno == ENXIO) {
				if (verbose)
					ui__warning("%s event is not supported by the kernel.\n",
						    event_name(counter));
						    perf_evsel__name(counter));
				counter->supported = false;
				continue;
			}
@@ -594,7 +594,7 @@ static void nsec_printout(int cpu, struct perf_evsel *evsel, double avg)
			csv_output ? 0 : -4,
			evsel_list->cpus->map[cpu], csv_sep);

	fprintf(output, fmt, cpustr, msecs, csv_sep, event_name(evsel));
	fprintf(output, fmt, cpustr, msecs, csv_sep, perf_evsel__name(evsel));

	if (evsel->cgrp)
		fprintf(output, "%s%s", csv_sep, evsel->cgrp->name);
@@ -792,7 +792,7 @@ static void abs_printout(int cpu, struct perf_evsel *evsel, double avg)
	else
		cpu = 0;

	fprintf(output, fmt, cpustr, avg, csv_sep, event_name(evsel));
	fprintf(output, fmt, cpustr, avg, csv_sep, perf_evsel__name(evsel));

	if (evsel->cgrp)
		fprintf(output, "%s%s", csv_sep, evsel->cgrp->name);
@@ -908,7 +908,7 @@ static void print_counter_aggr(struct perf_evsel *counter)
			counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED,
			csv_sep,
			csv_output ? 0 : -24,
			event_name(counter));
			perf_evsel__name(counter));

		if (counter->cgrp)
			fprintf(output, "%s%s", csv_sep, counter->cgrp->name);
@@ -961,7 +961,7 @@ static void print_counter(struct perf_evsel *counter)
				counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED,
				csv_sep,
				csv_output ? 0 : -24,
				event_name(counter));
				perf_evsel__name(counter));

			if (counter->cgrp)
				fprintf(output, "%s%s",
+1 −1
Original line number Diff line number Diff line
@@ -583,7 +583,7 @@ static int test__basic_mmap(void)
		if (nr_events[evsel->idx] != expected_nr_events[evsel->idx]) {
			pr_debug("expected %d %s events, got %d\n",
				 expected_nr_events[evsel->idx],
				 event_name(evsel), nr_events[evsel->idx]);
				 perf_evsel__name(evsel), nr_events[evsel->idx]);
			goto out_munmap;
		}
	}
Loading