|
|
@ -30,9 +30,11 @@ import (
|
|
|
|
"errors"
|
|
|
|
"errors"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
"unsafe"
|
|
|
|
"unsafe"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/shirou/gopsutil/internal/common"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func IOCounters() (map[string]IOCountersStat, error) {
|
|
|
|
func IOCountersForNames(names []string) (map[string]IOCountersStat, error) {
|
|
|
|
if C.StartIOCounterFetch() == 0 {
|
|
|
|
if C.StartIOCounterFetch() == 0 {
|
|
|
|
return nil, errors.New("Unable to fetch disk list")
|
|
|
|
return nil, errors.New("Unable to fetch disk list")
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -78,6 +80,10 @@ func IOCounters() (map[string]IOCountersStat, error) {
|
|
|
|
Name: strings.TrimFunc(C.GoStringN(&di.DiskName[0], C.MAX_DISK_NAME), isRuneNull),
|
|
|
|
Name: strings.TrimFunc(C.GoStringN(&di.DiskName[0], C.MAX_DISK_NAME), isRuneNull),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(names) > 0 && !common.StringsHas(names, d.Name) {
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ret[d.Name] = d
|
|
|
|
ret[d.Name] = d
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|