Merge branch 'master' of http://git.sysphere.org/vicious
This commit is contained in:
commit
bf5e2b7bc6
1
README
1
README
|
@ -515,3 +515,4 @@ Vicious contributors:
|
||||||
- Rémy C. <shikamaru mandriva.org>
|
- Rémy C. <shikamaru mandriva.org>
|
||||||
- Hiltjo Posthuma <hiltjo codemadness.org>
|
- Hiltjo Posthuma <hiltjo codemadness.org>
|
||||||
- Hagen Schink <troja84 googlemail.com>
|
- Hagen Schink <troja84 googlemail.com>
|
||||||
|
- Jörg Thalheim <jthalheim gmail.com>
|
||||||
|
|
|
@ -42,33 +42,29 @@ local function worker(format)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Ensure tables are initialized correctly
|
-- Ensure tables are initialized correctly
|
||||||
while #cpu_total < #cpu_lines do
|
for i = #cpu_total + 1, #cpu_lines do
|
||||||
table.insert(cpu_total, 0)
|
cpu_total[i] = 0
|
||||||
table.insert(cpu_active, 0)
|
cpu_usage[i] = 0
|
||||||
table.insert(cpu_usage, 0)
|
cpu_active[i] = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local total_new = {}
|
|
||||||
local active_new = {}
|
|
||||||
local diff_total = {}
|
|
||||||
local diff_active = {}
|
|
||||||
|
|
||||||
for i, v in ipairs(cpu_lines) do
|
for i, v in ipairs(cpu_lines) do
|
||||||
-- Calculate totals
|
-- Calculate totals
|
||||||
total_new[i] = 0
|
local total_new = 0
|
||||||
for j = 1, #v do
|
for j = 1, #v do
|
||||||
total_new[i] = total_new[i] + v[j]
|
total_new = total_new + v[j]
|
||||||
end
|
end
|
||||||
active_new[i] = v[1] + v[2] + v[3]
|
local active_new = total_new - (v[4] + v[5])
|
||||||
|
|
||||||
-- Calculate percentage
|
-- Calculate percentage
|
||||||
diff_total[i] = total_new[i] - cpu_total[i]
|
local diff_total = total_new - cpu_total[i]
|
||||||
diff_active[i] = active_new[i] - cpu_active[i]
|
local diff_active = active_new - cpu_active[i]
|
||||||
cpu_usage[i] = math.floor(diff_active[i] / diff_total[i] * 100)
|
cpu_usage[i] = math.floor((diff_active / diff_total) * 100)
|
||||||
|
|
||||||
-- Store totals
|
-- Store totals
|
||||||
cpu_total[i] = total_new[i]
|
cpu_total[i] = total_new
|
||||||
cpu_active[i] = active_new[i]
|
cpu_active[i] = active_new
|
||||||
end
|
end
|
||||||
|
|
||||||
return cpu_usage
|
return cpu_usage
|
||||||
|
|
|
@ -36,7 +36,7 @@ local rss = {
|
||||||
--},
|
--},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Default is all unread
|
-- Default is just Inbox
|
||||||
local feed = rss.inbox
|
local feed = rss.inbox
|
||||||
local mail = {
|
local mail = {
|
||||||
["{count}"] = 0,
|
["{count}"] = 0,
|
||||||
|
|
Loading…
Reference in New Issue