mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-26 13:48:59 +08:00
net[darwin]: add drop count to NetIOCounter.
This commit is contained in:
parent
e0b1d62a4d
commit
6bb6762470
@ -43,7 +43,7 @@ func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
|
||||
base = 0
|
||||
}
|
||||
|
||||
parsed := make([]uint64, 0, 6)
|
||||
parsed := make([]uint64, 0, 7)
|
||||
vv := []string{
|
||||
values[base+3], // Ipkts == PacketsRecv
|
||||
values[base+4], // Ierrs == Errin
|
||||
@ -52,6 +52,10 @@ func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
|
||||
values[base+7], // Oerrs == Errout
|
||||
values[base+8], // Obytes == BytesSent
|
||||
}
|
||||
if len(values) == 12 {
|
||||
vv = append(vv, values[base+10])
|
||||
}
|
||||
|
||||
for _, target := range vv {
|
||||
if target == "-" {
|
||||
parsed = append(parsed, 0)
|
||||
@ -74,6 +78,9 @@ func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
|
||||
Errout: parsed[4],
|
||||
BytesSent: parsed[5],
|
||||
}
|
||||
if len(parsed) == 7 {
|
||||
n.Dropout = parsed[6]
|
||||
}
|
||||
ret = append(ret, n)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user