Skip to content
Snippets Groups Projects
Commit 6ee65907 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-announce: add number of CPUs

parent 0d4dd90e
No related branches found
No related tags found
No related merge requests found
local n = 0
local cpus = util.trim(fs.readfile('/sys/devices/system/cpu/online'))
for _, entry in ipairs(cpus:split(',')) do
local x, y = entry:match('(%d+)-(%d+)')
if x then
n = n + tonumber(y) - tonumber(x) + 1
else
n = n + 1
end
end
return n
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment