mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Integrate NAN check into assignment
The check for NAN is kept to avoid relying on implementation details of the CLAMP macro/function
This commit is contained in:
parent
cb8bb12974
commit
0e922d4085
@ -176,10 +176,7 @@ double Platform_setCPUValues(Meter* this, int cpu) {
|
||||
percent = v[0] + v[1] + v[2];
|
||||
}
|
||||
|
||||
percent = CLAMP(percent, 0.0, 100.0);
|
||||
if (isnan(percent)) {
|
||||
percent = 0.0;
|
||||
}
|
||||
percent = isnan(percent) ? 0.0 : CLAMP(percent, 0.0, 100.0);
|
||||
|
||||
v[CPU_METER_FREQUENCY] = NAN;
|
||||
|
||||
|
@ -1055,10 +1055,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
|
||||
}
|
||||
|
||||
float percent_cpu = (lp->utime + lp->stime - lasttimes) / period * 100.0;
|
||||
proc->percent_cpu = CLAMP(percent_cpu, 0.0, cpus * 100.0);
|
||||
if (isnan(proc->percent_cpu))
|
||||
proc->percent_cpu = 0.0;
|
||||
|
||||
proc->percent_cpu = isnan(percent_cpu) ? 0.0 : CLAMP(percent_cpu, 0.0, cpus * 100.0);
|
||||
proc->percent_mem = (proc->m_resident * CRT_pageSizeKB) / (double)(pl->totalMem) * 100.0;
|
||||
|
||||
if (!preExisting) {
|
||||
|
@ -200,10 +200,7 @@ double Platform_setCPUValues(Meter* this, int cpu) {
|
||||
percent = v[0] + v[1] + v[2];
|
||||
}
|
||||
|
||||
percent = CLAMP(percent, 0.0, 100.0);
|
||||
if (isnan(percent)) {
|
||||
percent = 0.0;
|
||||
}
|
||||
percent = isnan(percent) ? 0.0 : CLAMP(percent, 0.0, 100.0);
|
||||
|
||||
v[CPU_METER_FREQUENCY] = NAN;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user