dio: import string.match()
This commit is contained in:
parent
c2f7fbcf23
commit
729ceb7865
|
@ -7,6 +7,7 @@
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local io = { lines = io.lines }
|
local io = { lines = io.lines }
|
||||||
local setmetatable = setmetatable
|
local setmetatable = setmetatable
|
||||||
|
local string = { match = string.match }
|
||||||
local helpers = require("vicious.helpers")
|
local helpers = require("vicious.helpers")
|
||||||
local os = {
|
local os = {
|
||||||
time = os.time,
|
time = os.time,
|
||||||
|
@ -32,8 +33,8 @@ local function worker(format)
|
||||||
|
|
||||||
for line in io.lines("/proc/diskstats") do
|
for line in io.lines("/proc/diskstats") do
|
||||||
local device, read, write =
|
local device, read, write =
|
||||||
-- Linux kernel docs: Documentation/iostats.txt
|
-- Linux kernel documentation: Documentation/iostats.txt
|
||||||
line:match("([^%s]+) %d+ %d+ (%d+) %d+ %d+ %d+ (%d+)")
|
string.match(line, "([^%s]+) %d+ %d+ (%d+) %d+ %d+ %d+ (%d+)")
|
||||||
disk_lines[device] = { read, write }
|
disk_lines[device] = { read, write }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue