Reindent file to get rid of tabs
This commit is contained in:
parent
eab7811a21
commit
d049694c29
|
@ -33,26 +33,26 @@ cpu_openbsd.ticks = { 0, 0, 0, 0, 0, 0 }
|
|||
|
||||
function cpu_openbsd.async(format, warg, callback)
|
||||
helpers.sysctl_async({ "kern.cp_time" },
|
||||
function (ret)
|
||||
local current_ticks = {}
|
||||
for match in string.gmatch(ret["kern.cp_time"], "(%d+)") do
|
||||
table.insert(current_ticks, tonumber(match))
|
||||
end
|
||||
function (ret)
|
||||
local current_ticks = {}
|
||||
for match in string.gmatch(ret["kern.cp_time"], "(%d+)") do
|
||||
table.insert(current_ticks, tonumber(match))
|
||||
end
|
||||
|
||||
local period_ticks = {}
|
||||
for i=1, 6 do
|
||||
table.insert(period_ticks,
|
||||
current_ticks[i] - cpu_openbsd.ticks[i])
|
||||
end
|
||||
local period_ticks = {}
|
||||
for i = 1, 6 do
|
||||
table.insert(period_ticks,
|
||||
current_ticks[i] - cpu_openbsd.ticks[i])
|
||||
end
|
||||
|
||||
local cpu_total, cpu_busy = 0, 0
|
||||
for i = 1, 6 do cpu_total = cpu_total + period_ticks[i] end
|
||||
for i = 1, 5 do cpu_busy = cpu_busy + period_ticks[i] end
|
||||
local cpu_total, cpu_busy = 0, 0
|
||||
for i = 1, 6 do cpu_total = cpu_total + period_ticks[i] end
|
||||
for i = 1, 5 do cpu_busy = cpu_busy + period_ticks[i] end
|
||||
|
||||
local cpu_usage = math.ceil((cpu_busy / cpu_total) * 100 )
|
||||
local cpu_usage = math.ceil((cpu_busy / cpu_total) * 100 )
|
||||
|
||||
cpu_openbsd.ticks = current_ticks
|
||||
return callback({ cpu_usage })
|
||||
cpu_openbsd.ticks = current_ticks
|
||||
return callback({ cpu_usage })
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue