Created
December 25, 2014 19:25
-
-
Save r0mdau/20eebef551cfef931ffe to your computer and use it in GitHub Desktop.
Get host processors from openvz VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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