Skip to content

Commit

Permalink
Return -1 instead of not ready
Browse files Browse the repository at this point in the history
  • Loading branch information
Soulou committed Oct 15, 2014
1 parent f515508 commit a15b553
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cpu/cpu.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cpu

import (
"errors"
"fmt"
"log"
"os"
Expand Down Expand Up @@ -94,7 +93,7 @@ func GetUsage(id string) (int64, error) {
return -1, err
}
if _, ok := previousCpuUsages[id]; !ok {
return -1, errors.New("not ready")
return -1, nil
}
return int64((float64((cpuUsages[id] - previousCpuUsages[id])) / float64(1e9) / float64(RefreshTime)) * 100), nil
}

0 comments on commit a15b553

Please sign in to comment.