|
@@ -31,7 +31,7 @@ func (g *GuptaReport) GetCPULoad() string {
|
|
|
|
|
|
// collect all CPU stat from /proc/cpustat
|
|
|
type CPUStat struct {
|
|
|
- user uint64
|
|
|
+ User uint64
|
|
|
nice uint64
|
|
|
system uint64
|
|
|
idle uint64
|
|
@@ -46,7 +46,7 @@ type CPUStat struct {
|
|
|
// parse the first line of /proc/cpustat
|
|
|
func (c *CPUStat) ReadInfo(rawInfo []string) {
|
|
|
if s, err := strconv.ParseUint(rawInfo[0], 10, 64); err == nil {
|
|
|
- c.user = s
|
|
|
+ c.User = s
|
|
|
}
|
|
|
if s, err := strconv.ParseUint(rawInfo[1], 10, 64); err == nil {
|
|
|
c.nice = s
|
|
@@ -80,7 +80,6 @@ func (c *CPUStat) ReadInfo(rawInfo []string) {
|
|
|
func NewCPUStat(procstatline string) CPUStat {
|
|
|
cpustat := CPUStat{}
|
|
|
statline := strings.Fields(procstatline)
|
|
|
- fmt.Println(statline)
|
|
|
- cpustat.ReadInfo(statline)
|
|
|
+ cpustat.ReadInfo(statline[1:])
|
|
|
return cpustat
|
|
|
}
|