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

cpu.CPUInfo() returns empty []cpu.CPUInfoStat object on linux #101

Closed
ghost opened this issue Oct 19, 2015 · 4 comments
Closed

cpu.CPUInfo() returns empty []cpu.CPUInfoStat object on linux #101

ghost opened this issue Oct 19, 2015 · 4 comments

Comments

@ghost
Copy link

ghost commented Oct 19, 2015

The cpu library appears to be broken on linux, found while chasing down hashicorp/nomad#302

Tested with the following code:

// snippets2
package main

import (
"github.com/davecgh/go-spew/spew"
"github.com/shirou/gopsutil/cpu"
)

func main() {
info, err := cpu.CPUInfo()
if err != nil {
    panic(err)
}
spew.Dump(info)
}

On darwin I get this:

([]cpu.CPUInfoStat) (len=1 cap=1) {
 (cpu.CPUInfoStat) {"cpu":0,"vendor_id":"GenuineIntel","family":"6","model":"70","stepping":1,"physical_id":"","core_id":"","cores":4,"model_name":"Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz","mhz":2300,"cache_size":256,"flags":["fpu","vme","de","pse","tsc","msr","pae","mce","cx8","apic","sep","mtrr","pge","mca","cmov","pat","pse36","clfsh","ds","acpi","mmx","fxsr","sse","sse2","ss","htt","tm","pbe","sse3","pclmulqdq","dtes64","mon","dscpl","vmx","smx","est","tm2","ssse3","fma","cx16","tpr","pdcm","sse4.1","sse4.2","x2apic","movbe","popcnt","aes","pcid","xsave","osxsave","seglim64","tsctmr","avx1.0","rdrand","f16c","smep","erms","rdwrfsgs","tsc_thread_offset","bmi1","hle","avx2","bmi2","invpcid","rtm","syscall","xd","1gbpage","em64t","lahf","lzcnt","rdtscp","tsci"]}

}

On CentOS Linux release 7.1.1503 (Core)

([]cpu.CPUInfoStat) <nil>

This is with go version 1.5.1 in both places. Running as root doesn't make a difference. Tested with a 'go get' of the library a few minutes ago.

@kardianos
Copy link
Contributor

That function is broken at tip right now. PR #98 fixes the issue (path combine bug).

@kardianos
Copy link
Contributor

This is fixed at tip and can probably be closed. Can you re-test?

@ghost
Copy link
Author

ghost commented Oct 23, 2015

I will rebuild my test environment this evening and get back to you.

@shirou
Copy link
Owner

shirou commented Dec 9, 2015

@rvm2015
How about your build at latest revision? I close this issue. if you still have a problem, feel free to reopen.
Thank you!

@shirou shirou closed this as completed Dec 9, 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