提交 f8b1b174 编写于 作者: N Nikolay Sivko

DiskIOCountersStat.IoTime on linux

上级 83ca5491
......@@ -31,6 +31,7 @@ type DiskIOCountersStat struct {
ReadTime uint64 `json:"readTime"`
WriteTime uint64 `json:"writeTime"`
Name string `json:"name"`
IoTime uint64 `json:"ioTime"`
}
func (d DiskUsageStat) String() string {
......
......@@ -54,6 +54,7 @@ func DiskIOCounters() (map[string]DiskIOCountersStat, error) {
writes := mustParseUint64(fields[7])
wbytes := mustParseUint64(fields[9])
wtime := mustParseUint64(fields[10])
iotime := mustParseUint64(fields[13])
d := DiskIOCountersStat{
ReadBytes: rbytes * SectorSize,
WriteBytes: wbytes * SectorSize,
......@@ -61,6 +62,7 @@ func DiskIOCounters() (map[string]DiskIOCountersStat, error) {
WriteCount: writes,
ReadTime: rtime,
WriteTime: wtime,
IoTime: iotime,
}
if d == empty {
continue
......
......@@ -85,7 +85,7 @@ func TestDiskIOCountersStat_String(t *testing.T) {
ReadBytes: 300,
WriteBytes: 400,
}
e := `{"readCount":100,"writeCount":200,"readBytes":300,"writeBytes":400,"readTime":0,"writeTime":0,"name":"sd01"}`
e := `{"readCount":100,"writeCount":200,"readBytes":300,"writeBytes":400,"readTime":0,"writeTime":0,"name":"sd01","ioTime":0}`
if e != fmt.Sprintf("%v", v) {
t.Errorf("DiskUsageStat string is invalid: %v", v)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册