Merge pull request #351 from danielnelson/io-counters-for-names
Make IOCounters a variadic function
This commit is contained in:
commit
70693b6a3d
|
@ -62,7 +62,3 @@ func (d IOCountersStat) String() string {
|
|||
s, _ := json.Marshal(d)
|
||||
return string(s)
|
||||
}
|
||||
|
||||
func IOCounters() (map[string]IOCountersStat, error) {
|
||||
return IOCountersForNames([]string{})
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import (
|
|||
"github.com/shirou/gopsutil/internal/common"
|
||||
)
|
||||
|
||||
func IOCountersForNames(names []string) (map[string]IOCountersStat, error) {
|
||||
func IOCounters(names ...string) (map[string]IOCountersStat, error) {
|
||||
if C.StartIOCounterFetch() == 0 {
|
||||
return nil, errors.New("Unable to fetch disk list")
|
||||
}
|
||||
|
|
|
@ -5,6 +5,6 @@ package disk
|
|||
|
||||
import "github.com/shirou/gopsutil/internal/common"
|
||||
|
||||
func IOCountersForNames(names []string) (map[string]IOCountersStat, error) {
|
||||
func IOCounters(names ...string) (map[string]IOCountersStat, error) {
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ package disk
|
|||
|
||||
import "github.com/shirou/gopsutil/internal/common"
|
||||
|
||||
func IOCountersForNames(names []string) (map[string]IOCountersStat, error) {
|
||||
func IOCounters(names ...string) (map[string]IOCountersStat, error) {
|
||||
return nil, common.ErrNotImplementedError
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ func Partitions(all bool) ([]PartitionStat, error) {
|
|||
return ret, nil
|
||||
}
|
||||
|
||||
func IOCountersForNames(names []string) (map[string]IOCountersStat, error) {
|
||||
func IOCounters(names ...string) (map[string]IOCountersStat, error) {
|
||||
// statinfo->devinfo->devstat
|
||||
// /usr/include/devinfo.h
|
||||
ret := make(map[string]IOCountersStat)
|
||||
|
|
|
@ -272,7 +272,7 @@ func getFileSystems() ([]string, error) {
|
|||
return ret, nil
|
||||
}
|
||||
|
||||
func IOCountersForNames(names []string) (map[string]IOCountersStat, error) {
|
||||
func IOCounters(names ...string) (map[string]IOCountersStat, error) {
|
||||
filename := common.HostProc("diskstats")
|
||||
lines, err := common.ReadLines(filename)
|
||||
if err != nil {
|
||||
|
|
|
@ -63,7 +63,7 @@ func Partitions(all bool) ([]PartitionStat, error) {
|
|||
return ret, nil
|
||||
}
|
||||
|
||||
func IOCountersForNames(names []string) (map[string]IOCountersStat, error) {
|
||||
func IOCounters(names ...string) (map[string]IOCountersStat, error) {
|
||||
ret := make(map[string]IOCountersStat)
|
||||
|
||||
r, err := syscall.Sysctl("hw.diskstats")
|
||||
|
|
|
@ -129,7 +129,7 @@ func Partitions(all bool) ([]PartitionStat, error) {
|
|||
return ret, nil
|
||||
}
|
||||
|
||||
func IOCountersForNames(names []string) (map[string]IOCountersStat, error) {
|
||||
func IOCounters(names ...string) (map[string]IOCountersStat, error) {
|
||||
ret := make(map[string]IOCountersStat, 0)
|
||||
var dst []Win32_PerfFormattedData
|
||||
|
||||
|
|
Loading…
Reference in New Issue