aboutsummaryrefslogtreecommitdiff
path: root/cpuinf.lua
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2010-03-14 01:55:33 +0100
committerAdrian C. (anrxc) <anrxc@sysphere.org>2010-03-14 01:55:33 +0100
commit237470c8f45190b213e3a173ce6ae1a74b3e11fe (patch)
tree7f53c8144761947d4bde20715bcad34f4be0d6c0 /cpuinf.lua
parent9a82d4113a8271b7dfc7506f2b07379e3ede89a8 (diff)
downloadvicious-legacy-237470c8f45190b213e3a173ce6ae1a74b3e11fe.tar.xz
API: transform widgets namespace table to a directory
Diffstat (limited to 'cpuinf.lua')
-rw-r--r--cpuinf.lua44
1 files changed, 0 insertions, 44 deletions
diff --git a/cpuinf.lua b/cpuinf.lua
deleted file mode 100644
index f9df451..0000000
--- a/cpuinf.lua
+++ /dev/null
@@ -1,44 +0,0 @@
----------------------------------------------------
--- Licensed under the GNU General Public License v2
--- * (c) 2010, Adrian C. <anrxc@sysphere.org>
----------------------------------------------------
-
--- {{{ Grab environment
-local tonumber = tonumber
-local io = { lines = io.lines }
-local setmetatable = setmetatable
-local string = { gmatch = string.gmatch }
--- }}}
-
-
--- Cpuinf: provides speed and cache information for all available CPUs/cores
-module("vicious.cpuinf")
-
-
--- {{{ CPU Information widget type
-local function worker(format)
- local id = nil
- local cpu_info = {}
-
- -- Get CPU info
- for line in io.lines("/proc/cpuinfo") do
- for k, v in string.gmatch(line, "([%a%s]+)[%s]+:[%s]([%d]+).-$") do
- if k == "processor" then
- id = v
- elseif k == "cpu MHz\t" or k == "cpu MHz" then
- local speed = tonumber(v)
- cpu_info["{cpu"..id.." mhz}"] = speed
- cpu_info["{cpu"..id.." ghz}"] = speed / 1000
- elseif k == "cache size" then
- local cache = tonumber(v)
- cpu_info["{cpu"..id.." kb}"] = cache
- cpu_info["{cpu"..id.." mb}"] = cache / 1024
- end
- end
- end
-
- return cpu_info
-end
--- }}}
-
-setmetatable(_M, { __call = function(_, ...) return worker(...) end })