Skip to content

Instantly share code, notes, and snippets.

@r0mdau
Created December 25, 2014 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r0mdau/20eebef551cfef931ffe to your computer and use it in GitHub Desktop.
Save r0mdau/20eebef551cfef931ffe to your computer and use it in GitHub Desktop.
Get host processors from openvz VM
#include <stdio.h>
#include <unistd.h>
int main(){
int num_processors = 0;
#if defined(_SC_NPROCESSORS_CONF)
num_processors = sysconf(_SC_NPROCESSORS_CONF);
#endif
printf("%d\n", num_processors);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment