summaryrefslogtreecommitdiffstats
path: root/collectors/proc.plugin/proc_stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/proc.plugin/proc_stat.c')
-rw-r--r--collectors/proc.plugin/proc_stat.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/collectors/proc.plugin/proc_stat.c b/collectors/proc.plugin/proc_stat.c
index f98b09561..5e6b79fc8 100644
--- a/collectors/proc.plugin/proc_stat.c
+++ b/collectors/proc.plugin/proc_stat.c
@@ -993,6 +993,15 @@ int do_proc_stat(int update_every, usec_t dt) {
for(core = 0; core < schedstat_cores_found; core++) {
if(unlikely(!(cpuidle_charts[core].active_time - cpuidle_charts[core].last_active_time))) {
pthread_t thread;
+ cpu_set_t global_cpu_set;
+
+ if (likely(!pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &global_cpu_set))) {
+ if (unlikely(!CPU_ISSET(core, &global_cpu_set))) {
+ continue;
+ }
+ }
+ else
+ error("Cannot read current process affinity");
if(unlikely(pthread_create(&thread, NULL, wake_cpu_thread, (void *)&core)))
error("Cannot create wake_cpu_thread");