Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in mac/ubuntu/centos can't get cpu time. #63

Closed
xiaods opened this issue Aug 27, 2015 · 4 comments
Closed

in mac/ubuntu/centos can't get cpu time. #63

xiaods opened this issue Aug 27, 2015 · 4 comments

Comments

@xiaods
Copy link

xiaods commented Aug 27, 2015

$ go test -v
=== RUN TestCpu_times
--- FAIL: TestCpu_times (0.00s)
cpu_test.go:13: error could not get cpu time
cpu_test.go:16: could not get CPUs could not get cpu time
=== RUN TestCpu_counts
--- PASS: TestCpu_counts (0.00s)
=== RUN TestCPUTimeStat_String
--- PASS: TestCPUTimeStat_String (0.00s)
=== RUN TestCpuInfo
--- PASS: TestCpuInfo (0.00s)
=== RUN TestCPUPercent
--- FAIL: TestCPUPercent (0.00s)
cpu_test.go:72: error could not get cpu time
cpu_test.go:75: wrong number of entries from CPUPercent: []
=== RUN TestCPUPercentPerCpu
--- FAIL: TestCPUPercentPerCpu (0.00s)
cpu_test.go:72: error could not get cpu time
cpu_test.go:75: wrong number of entries from CPUPercent: []
FAIL
exit status 1
FAIL github.com/shirou/gopsutil/cpu 0.007s

@shirou
Copy link
Owner

shirou commented Aug 27, 2015

on my environment (Linux 3.13.0-57-generic #95-Ubuntu SMP and Mac OS X yosemite), it works.

 go test -v 
=== RUN TestCpu_times
--- PASS: TestCpu_times (0.00s)
=== RUN TestCpu_counts
--- PASS: TestCpu_counts (0.00s)
=== RUN TestCPUTimeStat_String
--- PASS: TestCPUTimeStat_String (0.00s)
=== RUN TestCpuInfo
--- PASS: TestCpuInfo (0.00s)
=== RUN TestCPUPercent
--- PASS: TestCPUPercent (0.01s)
=== RUN TestCPUPercentPerCpu
--- PASS: TestCPUPercentPerCpu (0.02s)
PASS
ok      github.com/shirou/gopsutil/cpu  0.031s

Could you tell me what commit id you tested and your environment?

Thank you.

@xiaods
Copy link
Author

xiaods commented Sep 1, 2015

mac 10.10.5
today i found you update some code relative cpu. let me check a again.

@shirou
Copy link
Owner

shirou commented Sep 17, 2015

@xiaods I have changed to use CGO on darwin on 47f6760. Could you check it out? Thank you.

@xiaods
Copy link
Author

xiaods commented Sep 22, 2015

@shirou it works now. thanks for your help.

@xiaods xiaods closed this as completed Sep 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants