added nprocs.c and Makefile

git-svn-id: svn://anubis/misc/nprocs@85 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
josh 2008-12-06 18:30:48 +00:00
parent c0a23473e3
commit f189f5c08d
2 changed files with 19 additions and 0 deletions

8
Makefile Normal file
View File

@ -0,0 +1,8 @@
all: nprocs
nprocs: nprocs.c
$(CC) -o $@ $<
clean:
-rm -f *.o *~ nprocs

11
nprocs.c Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
#include <unistd.h> /* sysconf() */
int main(int argc, char * argv[])
{
int nprocs = sysconf(_SC_NPROCESSORS_CONF);
printf("Number of processors: %d\n", nprocs);
return 0;
}