On Thu, 13 Mar 2014 20:50:38 +0100
Markus Teich <markus.te...@stusta.mhn.de> wrote:

> Thanks for the hint. However I wanted to avoid spawning other
> processes as much as possible. Is there another way to count the cpu
> cores just by reading a file in /proc or maybe /sys?

You can get there by using sysconf(3), from man page:

"The sysconf() function conforms to IEEE Std 1003.1-1988 (``POSIX.1'').
The constants _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN are not
part of the standard, but are provided by many systems."

Calling "sysconf(_SC_NPROCESSORS_CONF)" should work on many systems.
I'm clueless, when it comes to accessing C from Go, so this can be
wrong solution in your case. 


-- 
Paul Onyschuk

Reply via email to