Merge pull request #75 from jinto/jinto

Detect error in CPUTimes fails on callPs, and modify comments on ReadLines
pull/79/head
shirou 10 years ago
commit 026d4a3519

@ -17,7 +17,7 @@ import (
var NotImplementedError = errors.New("not implemented yet")
// ReadLines reads contents from file and splits them by new line.
// ReadLines reads contents from a file and splits them by new lines.
// A convenience wrapper to ReadLinesOffsetN(filename, 0, -1).
func ReadLines(filename string) ([]string, error) {
return ReadLinesOffsetN(filename, 0, -1)

@ -215,6 +215,10 @@ func convertCpuTimes(s string) (ret float64, err error) {
func (p *Process) CPUTimes() (*cpu.CPUTimesStat, error) {
r, err := callPs("utime,stime", p.Pid, false)
if err != nil {
return nil, err
}
utime, err := convertCpuTimes(r[0][0])
if err != nil {
return nil, err

Loading…
Cancel
Save