|
|
|
@ -83,6 +83,8 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
|
|
|
|
|
return ret, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var kstatSplit = regexp.MustCompile(`[:\s]+`)
|
|
|
|
|
|
|
|
|
|
func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) {
|
|
|
|
|
var issolaris bool
|
|
|
|
|
if runtime.GOOS == "illumos" {
|
|
|
|
@ -107,7 +109,6 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
|
|
|
|
|
writesarr := make(map[string]uint64)
|
|
|
|
|
rtimearr := make(map[string]uint64)
|
|
|
|
|
wtimearr := make(map[string]uint64)
|
|
|
|
|
re := regexp.MustCompile(`[:\s]+`)
|
|
|
|
|
|
|
|
|
|
// in case the name is "/dev/sda1", then convert to "sda1"
|
|
|
|
|
for i, name := range names {
|
|
|
|
@ -115,7 +116,7 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, line := range lines {
|
|
|
|
|
fields := re.Split(line, -1)
|
|
|
|
|
fields := kstatSplit.Split(line, -1)
|
|
|
|
|
if len(fields) == 0 {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|