From 17c93e2be4ad7b3af0cd6878bdd5d8a4a3e6da99 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 28 Nov 2019 05:53:29 +0100 Subject: Merging upstream version 1.19.0. Signed-off-by: Daniel Baumann --- collectors/proc.plugin/proc_stat.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'collectors/proc.plugin/proc_stat.c') 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"); -- cgit v1.2.3