mirror of https://github.com/lcpz/lain.git
Update cpu.lua (#506)
I noticed once that the CPU usage was being reported as being '-1%', I dug around the code for a while and think that the change at line 52 should make sure no negative values are obtained. Co-authored-by: Pratik Devkota <pratikdevkota82@gmail.com>
This commit is contained in:
parent
2e5660faf8
commit
6bf79c30ae
|
@ -49,7 +49,7 @@ local function factory(args)
|
|||
-- Read current data and calculate relative values.
|
||||
local dactive = active - core.last_active
|
||||
local dtotal = total - core.last_total
|
||||
local usage = math.ceil((dactive / dtotal) * 100)
|
||||
local usage = math.ceil(math.abs((dactive / dtotal) * 100))
|
||||
|
||||
core.last_active = active
|
||||
core.last_total = total
|
||||
|
|
Loading…
Reference in New Issue