X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/88499d8694c8c7408bff5dd74a1a8134a49caf84..refs/pull/304/head:/client/util.c diff --git a/client/util.c b/client/util.c index 5c2579b1..13067ec1 100644 --- a/client/util.c +++ b/client/util.c @@ -656,3 +656,19 @@ uint64_t msclock() { return (t.tv_sec * 1000 + t.tv_nsec / 1000000); #endif } + +// determine number of logical CPU cores (use for multithreaded functions) +extern int num_CPUs(void) +{ +#if defined(_WIN32) + #include + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#elif defined(__linux__) || defined(__APPLE__) + #include + return sysconf(_SC_NPROCESSORS_ONLN); +#else + return 1; +#endif +}