Skip to content

Commit

Permalink
fix bug of net speed moniting
Browse files Browse the repository at this point in the history
  • Loading branch information
lonord committed Jun 19, 2018
1 parent 7f575fe commit cc6a129
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

VERSION=1.0
VERSION=1.1

cd $(dirname $0)

Expand Down
6 changes: 3 additions & 3 deletions netutil/netspeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ func (n *NetSpeedReader) Read() ([]NetSpeed, error) {
return nil, err
}
sMap := convertToDevStatusMapWithFilter(s, n.targetDevs)
speedList := cal(sMap, ls, int((t.UnixNano()-lt.UnixNano())/1000000))
speedList := cal(ls, sMap, uint64((t.UnixNano()-lt.UnixNano())/1000000))
n.recordTime = t
n.statusMap = sMap
return speedList, nil
}

func MeasureNetSpeed(timeSpanMilli int) ([]NetSpeed, error) {
func MeasureNetSpeed(timeSpanMilli uint64) ([]NetSpeed, error) {
status1, err := readDevStatusDefault()
if err != nil {
return nil, err
Expand All @@ -74,7 +74,7 @@ func readDevStatusDefault() ([]DevStatus, error) {
return ReadDevStatus(ba.DefaultFileReader)
}

func cal(map1, map2 map[string]DevStatus, timeSpanMilli int) []NetSpeed {
func cal(map1, map2 map[string]DevStatus, timeSpanMilli uint64) []NetSpeed {
speedList := []NetSpeed{}
for name := range map2 {
s1, ok1 := map1[name]
Expand Down

0 comments on commit cc6a129

Please sign in to comment.