The average CPU utilization value must never be marked 'offline'

Fixes https://github.com/htop-dev/htop/issues/729
This commit is contained in:
Nathan Scott 2021-08-10 13:58:55 +10:00 committed by BenBE
parent 6d3b4a0f2e
commit 02cfd38671
1 changed files with 2 additions and 1 deletions

View File

@ -171,7 +171,7 @@ static void LinuxProcessList_updateCPUcount(ProcessList* super) {
super->activeCPUs = 1; super->activeCPUs = 1;
super->existingCPUs = 1; super->existingCPUs = 1;
this->cpuData = xReallocArray(this->cpuData, 2, sizeof(CPUData)); this->cpuData = xReallocArray(this->cpuData, 2, sizeof(CPUData));
this->cpuData[0].online = true; this->cpuData[0].online = true; /* average is always "online" */
this->cpuData[1].online = true; this->cpuData[1].online = true;
return; return;
} }
@ -209,6 +209,7 @@ static void LinuxProcessList_updateCPUcount(ProcessList* super) {
for (unsigned int j = currExisting; j < max; j++) { for (unsigned int j = currExisting; j < max; j++) {
this->cpuData[j].online = false; this->cpuData[j].online = false;
} }
this->cpuData[0].online = true; /* average is always "online" */
currExisting = max; currExisting = max;
} }