dio: add I/O scheduler support
I/O scheduler information is stored in the key: {sched}
This commit is contained in:
parent
71f21f38c1
commit
6898d4a1a4
3
README
3
README
|
@ -227,7 +227,8 @@ vicious.widgets.dio
|
|||
- provides I/O statistics for requested storage devices
|
||||
- takes the disk as an argument, i.e. "sda"
|
||||
- returns a table with string keys: {total_s}, {total_kb}, {total_mb},
|
||||
{read_s}, {read_kb}, {read_mb}, {write_s}, {write_kb} and {write_mb}
|
||||
{read_s}, {read_kb}, {read_mb}, {write_s}, {write_kb}, {write_mb}
|
||||
and {sched}
|
||||
|
||||
vicious.widgets.hddtemp
|
||||
- provides hard drive temperatures using the hddtemp daemon
|
||||
|
|
6
dio.lua
6
dio.lua
|
@ -26,6 +26,7 @@ local unit = { ["s"] = 1, ["kb"] = 2, ["mb"] = 2048 }
|
|||
local function worker(format, disk)
|
||||
local disk_lines = { [disk] = {} }
|
||||
local disk_stats = helpers.pathtotable("/sys/block/" .. disk)
|
||||
local disk_queue = helpers.pathtotable("/sys/block/" .. disk .. "/queue")
|
||||
|
||||
if disk_stats.stat then
|
||||
local match = string.gmatch(disk_stats.stat, "[%s]+([%d]+)")
|
||||
|
@ -58,6 +59,11 @@ local function worker(format, disk)
|
|||
helpers.uformat(disk_usage[disk], "write", diff_total[disk][7], unit)
|
||||
helpers.uformat(disk_usage[disk], "total", diff_total[disk][7] + diff_total[disk][3], unit)
|
||||
|
||||
-- Store I/O scheduler
|
||||
if disk_queue.scheduler then
|
||||
disk_usage[disk]["{sched}"] = string.gmatch(disk_queue.scheduler, "%[([%a]+)%]")
|
||||
end
|
||||
|
||||
return disk_usage[disk]
|
||||
end
|
||||
-- }}}
|
||||
|
|
Loading…
Reference in New Issue