From 83b75e65286f7fa75f44f6eff3da69614f34bfc1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 16 May 2018 09:37:40 +0100 Subject: [PATCH] sources/perf: Add an explanatory comment for the CPU loop. I stumbled over this kernel restriction, too. --- lib/sources/sp-perf-source.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/sources/sp-perf-source.c b/lib/sources/sp-perf-source.c index dd4d7d19..a7da6cc7 100644 --- a/lib/sources/sp-perf-source.c +++ b/lib/sources/sp-perf-source.c @@ -314,6 +314,9 @@ sp_perf_source_start_pid (SpPerfSource *self, cpu = -1; } + /* Perf won't let us capture on all CPUs on all pids, so we have to + * loop over CPUs if we're not just watching a single pid. + */ for (; cpu < ncpu; cpu++) { attr.type = PERF_TYPE_HARDWARE;