diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2021-06-13 14:24:51 +0200 |
---|---|---|
committer | Benny Baumann <BenBE@geshi.org> | 2021-07-18 07:58:50 +0200 |
commit | edf236f9fcf257c5266cead0c3bc45087d937e65 (patch) | |
tree | 1a143b0cccbab5cbb9b3ebe65b485710a5183df1 /openbsd/Platform.c | |
parent | f608fc5c8aeb020a4ddb3297b71690f15a6179bf (diff) |
OpenBSD: support offline CPUs and hot-swapping
Diffstat (limited to 'openbsd/Platform.c')
-rw-r--r-- | openbsd/Platform.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/openbsd/Platform.c b/openbsd/Platform.c index 2116cccb..65133122 100644 --- a/openbsd/Platform.c +++ b/openbsd/Platform.c @@ -169,19 +169,12 @@ int Platform_getMaxPid() { double Platform_setCPUValues(Meter* this, unsigned int cpu) { const OpenBSDProcessList* pl = (const OpenBSDProcessList*) this->pl; - const CPUData* cpuData = NULL; + const CPUData* cpuData = &(pl->cpuData[cpu]); double total; double totalPercent; double* v = this->values; - for (unsigned int i = 0; i < pl->super.activeCPUs; i++) { - if (pl->cpus[i].cpuIndex == cpu) { - cpuData = &(pl->cpus[i]); - break; - } - } - - if (!cpuData) { + if (!cpuData->online) { this->curItems = 0; return NAN; } |