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

Commit 6484d2f9 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo
Browse files

libperf: Add nr_entries to struct perf_evlist



Move nr_entries count from 'struct perf' to into perf_evlist struct.

Committer notes:

Fix tools/perf/arch/s390/util/auxtrace.c case. And also the comment in
tools/perf/util/annotate.h.

Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190721112506.12306-42-jolsa@kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 52e22fb8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ struct auxtrace_record *auxtrace_record__init(struct evlist *evlist,
	int diagnose = 0;

	*err = 0;
	if (evlist->nr_entries == 0)
	if (evlist->core.nr_entries == 0)
		return NULL;

	evlist__for_each_entry(evlist, pos) {
+2 −2
Original line number Diff line number Diff line
@@ -1375,7 +1375,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
	 * because we synthesize event name through the pipe
	 * and need the id for that.
	 */
	if (data->is_pipe && rec->evlist->nr_entries == 1)
	if (data->is_pipe && rec->evlist->core.nr_entries == 1)
		rec->opts.sample_id = true;

	if (record__open(rec) != 0) {
@@ -2386,7 +2386,7 @@ int cmd_record(int argc, const char **argv)
	if (record.opts.overwrite)
		record.opts.tail_synthesize = true;

	if (rec->evlist->nr_entries == 0 &&
	if (rec->evlist->core.nr_entries == 0 &&
	    __perf_evlist__add_default(rec->evlist, !record.opts.no_samples) < 0) {
		pr_err("Not enough memory for event selector list\n");
		goto out;
+2 −2
Original line number Diff line number Diff line
@@ -1366,7 +1366,7 @@ static int add_default_attributes(void)
		free(str);
	}

	if (!evsel_list->nr_entries) {
	if (!evsel_list->core.nr_entries) {
		if (target__has_cpu(&target))
			default_attrs0[0].config = PERF_COUNT_SW_CPU_CLOCK;

@@ -1683,7 +1683,7 @@ static void setup_system_wide(int forks)
				return;
		}

		if (evsel_list->nr_entries)
		if (evsel_list->core.nr_entries)
			target.system_wide = true;
	}
}
+6 −6
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
	notes = symbol__annotation(sym);
	pthread_mutex_lock(&notes->lock);

	if (!symbol__hists(sym, top->evlist->nr_entries)) {
	if (!symbol__hists(sym, top->evlist->core.nr_entries)) {
		pthread_mutex_unlock(&notes->lock);
		pr_err("Not enough memory for annotating '%s' symbol!\n",
		       sym->name);
@@ -404,7 +404,7 @@ static void perf_top__print_mapped_keys(struct perf_top *top)
	fprintf(stdout, "\t[d]     display refresh delay.             \t(%d)\n", top->delay_secs);
	fprintf(stdout, "\t[e]     display entries (lines).           \t(%d)\n", top->print_entries);

	if (top->evlist->nr_entries > 1)
	if (top->evlist->core.nr_entries > 1)
		fprintf(stdout, "\t[E]     active event counter.              \t(%s)\n", perf_evsel__name(top->sym_evsel));

	fprintf(stdout, "\t[f]     profile display filter (count).    \t(%d)\n", top->count_filter);
@@ -439,7 +439,7 @@ static int perf_top__key_mapped(struct perf_top *top, int c)
		case 'S':
			return 1;
		case 'E':
			return top->evlist->nr_entries > 1 ? 1 : 0;
			return top->evlist->core.nr_entries > 1 ? 1 : 0;
		default:
			break;
	}
@@ -485,7 +485,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
			}
			break;
		case 'E':
			if (top->evlist->nr_entries > 1) {
			if (top->evlist->core.nr_entries > 1) {
				/* Select 0 as the default event: */
				int counter = 0;

@@ -496,7 +496,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)

				prompt_integer(&counter, "Enter details event counter");

				if (counter >= top->evlist->nr_entries) {
				if (counter >= top->evlist->core.nr_entries) {
					top->sym_evsel = perf_evlist__first(top->evlist);
					fprintf(stderr, "Sorry, no such event, using %s.\n", perf_evsel__name(top->sym_evsel));
					sleep(1);
@@ -1536,7 +1536,7 @@ int cmd_top(int argc, const char **argv)
	if (argc)
		usage_with_options(top_usage, options);

	if (!top.evlist->nr_entries &&
	if (!top.evlist->core.nr_entries &&
	    perf_evlist__add_default(top.evlist) < 0) {
		pr_err("Not enough memory for event selector list\n");
		goto out_delete_evlist;
+2 −2
Original line number Diff line number Diff line
@@ -4270,7 +4270,7 @@ int cmd_trace(int argc, const char **argv)
		symbol_conf.use_callchain = true;
	}

	if (trace.evlist->nr_entries > 0) {
	if (trace.evlist->core.nr_entries > 0) {
		evlist__set_evsel_handler(trace.evlist, trace__event_handler);
		if (evlist__set_syscall_tp_fields(trace.evlist)) {
			perror("failed to set syscalls:* tracepoint fields");
@@ -4368,7 +4368,7 @@ int cmd_trace(int argc, const char **argv)
		trace.summary = trace.summary_only;

	if (!trace.trace_syscalls && !trace.trace_pgfaults &&
	    trace.evlist->nr_entries == 0 /* Was --events used? */) {
	    trace.evlist->core.nr_entries == 0 /* Was --events used? */) {
		trace.trace_syscalls = true;
	}

Loading