[sysprof] sources/perf: Add an explanatory comment for the CPU loop.



commit 83b75e65286f7fa75f44f6eff3da69614f34bfc1
Author: Eric Anholt <eric anholt net>
Date:   Wed May 16 09:37:40 2018 +0100

    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 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/lib/sources/sp-perf-source.c b/lib/sources/sp-perf-source.c
index dd4d7d1..a7da6cc 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]