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

Commit 30c806a0 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

perf_counter tools: Handle kernels with !CONFIG_PERF_COUNTER



If perf is run on a !CONFIG_PERF_COUNTER kernel right now it
bails out with no messages or with confusing messages.

Standardize this case some more and explain the situation.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 3da297a6
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -356,9 +356,6 @@ static void create_counter(int counter, int cpu, pid_t pid)
	if (fd[nr_cpu][counter] < 0) {
		int err = errno;

		if (verbose)
			error("sys_perf_counter_open() syscall returned with %d (%s)\n",
				fd[nr_cpu][counter], strerror(err));
		if (err == EPERM)
			die("Permission error - are you root?\n");

@@ -376,6 +373,10 @@ static void create_counter(int counter, int cpu, pid_t pid)
			attr->config = PERF_COUNT_CPU_CLOCK;
			goto try_again;
		}
		printf("\n");
		error("perfcounter syscall returned with %d (%s)\n",
			fd[nr_cpu][counter], strerror(err));
		die("No CONFIG_PERF_COUNTERS=y kernel support configured?\n");
		exit(-1);
	}

+4 −4
Original line number Diff line number Diff line
@@ -551,10 +551,6 @@ static void start_counter(int i, int counter)
	if (fd[i][counter] < 0) {
		int err = errno;

		if (verbose)
			error("sys_perf_counter_open() syscall returned with %d (%s)\n",
				fd[i][counter], strerror(err));

		if (err == EPERM)
			die("No permission - are you root?\n");
		/*
@@ -572,6 +568,10 @@ static void start_counter(int i, int counter)
			attr->config = PERF_COUNT_CPU_CLOCK;
			goto try_again;
		}
		printf("\n");
		error("perfcounter syscall returned with %d (%s)\n",
			fd[i][counter], strerror(err));
		die("No CONFIG_PERF_COUNTERS=y kernel support configured?\n");
		exit(-1);
	}
	assert(fd[i][counter] >= 0);