gluon-announce: add number of CPUs
This commit is contained in:
parent
0d4dd90e2b
commit
6ee65907a4
@ -0,0 +1,14 @@
|
|||||||
|
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
|
Loading…
Reference in New Issue
Block a user