From f189f5c08d1fe34cee07819bd71324d964791c85 Mon Sep 17 00:00:00 2001 From: josh Date: Sat, 6 Dec 2008 18:30:48 +0000 Subject: [PATCH] added nprocs.c and Makefile git-svn-id: svn://anubis/misc/nprocs@85 bd8a9e45-a331-0410-811e-c64571078777 --- Makefile | 8 ++++++++ nprocs.c | 11 +++++++++++ 2 files changed, 19 insertions(+) create mode 100644 Makefile create mode 100644 nprocs.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..611ba79 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ + +all: nprocs + +nprocs: nprocs.c + $(CC) -o $@ $< + +clean: + -rm -f *.o *~ nprocs diff --git a/nprocs.c b/nprocs.c new file mode 100644 index 0000000..ad79141 --- /dev/null +++ b/nprocs.c @@ -0,0 +1,11 @@ + +#include +#include /* sysconf() */ + +int main(int argc, char * argv[]) +{ + int nprocs = sysconf(_SC_NPROCESSORS_CONF); + + printf("Number of processors: %d\n", nprocs); + return 0; +}