|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
//go:build !windows
|
|
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
|
|
package staros
|
|
|
|
@ -67,7 +68,13 @@ func NetSpeeds(duration time.Duration) ([]NetSpeed, error) {
|
|
|
|
|
for k, v := range list1 {
|
|
|
|
|
recv := float64(list2[k].RecvBytes-v.RecvBytes) / duration.Seconds()
|
|
|
|
|
send := float64(list2[k].SendBytes-v.SendBytes) / duration.Seconds()
|
|
|
|
|
res = append(res, NetSpeed{v.Name, recv, send})
|
|
|
|
|
res = append(res, NetSpeed{
|
|
|
|
|
Name: v.Name,
|
|
|
|
|
RecvSpeeds: recv,
|
|
|
|
|
SendSpeeds: send,
|
|
|
|
|
RecvBytes: list2[k].RecvBytes,
|
|
|
|
|
SendBytes: list2[k].SendBytes,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
return res, nil
|
|
|
|
|
}
|
|
|
|
|