Skip to content

Commit fe0c74f

Browse files
sysconf version faster
1 parent d08ad50 commit fe0c74f

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/util.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ int UTIL_countAvailableCores_posix_sysconf(void)
167167
/* Only parse /proc/cpuinfo
168168
* siblings / cpu cores should give hyperthreading ratio
169169
* otherwise fall back to 1 */
170+
// Simulate old version
171+
int UTIL_countAvailableCores(void) {
172+
return UTIL_countAvailableCores_posix_sysconf();
173+
}
170174
int UTIL_countAvailableCores_parse_cpuinfo(void)
171175
{
172176
time_t currTime = time(NULL);

src/util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ __attribute__((unused)) static time_t lastTimeCached = 0;
7676
__attribute__((unused)) static int util_cpuCoresCacheTTL = 60;
7777
#endif
7878
#if defined(__linux__)
79+
int UTIL_countAvailableCores(void);
7980
int UTIL_countAvailableCores_posix_sysconf(void);
8081
int UTIL_countAvailableCores_prse_cpuinfo(void);
8182
#else

0 commit comments

Comments
 (0)