This commit is contained in:
Joerg T. (Mic92) 2011-03-15 21:22:38 +01:00
commit bf5e2b7bc6
3 changed files with 14 additions and 17 deletions

1
README
View File

@ -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>

View File

@ -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

View File

@ -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,