Calculate Linux disk bytes read/written based on sector size (512B)
Logical sector size appears to be fixed at 512B for the foreseeable future in the kernel, so for now we just hard-code it.
This commit is contained in:
parent
6af5273937
commit
09e610ad37
3 changed files with 150 additions and 70 deletions
|
|
@ -37,4 +37,12 @@ func TestDiskStats(t *testing.T) {
|
|||
if want, got := "68", diskStats["mmcblk0p2"][10]; want != got {
|
||||
t.Errorf("want diskstats mmcblk0p2 %s, got %s", want, got)
|
||||
}
|
||||
|
||||
if want, got := "513713216512", diskStats["sda"][11]; want != got {
|
||||
t.Errorf("want diskstats sda read bytes %s, got %s", want, got)
|
||||
}
|
||||
|
||||
if want, got := "258916880384", diskStats["sda"][12]; want != got {
|
||||
t.Errorf("want diskstats sda write bytes %s, got %s", want, got)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue