diff options
author | Lukas Larsson <[email protected]> | 2015-07-16 15:36:44 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-02-02 10:45:22 +0100 |
commit | 6090f9c7e9b0ddbccef357641c1455475b348e94 (patch) | |
tree | 05651df115da49195739fa11009bc9c225f85ce8 /erts/emulator | |
parent | 0399f5fc547ef035c4eb5e383f30b28ae73d936e (diff) | |
download | otp-6090f9c7e9b0ddbccef357641c1455475b348e94.tar.gz otp-6090f9c7e9b0ddbccef357641c1455475b348e94.tar.bz2 otp-6090f9c7e9b0ddbccef357641c1455475b348e94.zip |
erts: Add power saving cpu feature tests and use them
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/sys/unix/sys_time.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/erts/emulator/sys/unix/sys_time.c b/erts/emulator/sys/unix/sys_time.c index 9738a8c352..03d39c7ce6 100644 --- a/erts/emulator/sys/unix/sys_time.c +++ b/erts/emulator/sys/unix/sys_time.c @@ -971,18 +971,18 @@ static ErtsSysPerfCounter calculate_perf_counter_unit(void) { static int have_rdtscp(void) { #if defined(ETHR_X86_RUNTIME_CONF__) - /* On early x86 cpu's the tsc varies with - the current speed of the cpu, which means that the time per - tick vary depending on the current load of the cpu. We do not - want this as it would give very scewed numbers when the cpu is - mostly idle. - If we have the rdtscp feature it is a sign that the cpu is - relatively modern, and thus the tsc quite stable so we use it then. + /* On early x86 cpu's the tsc varies with the current speed of the cpu, + which means that the time per tick vary depending on the current + load of the cpu. We do not want this as it would give very scewed + numbers when the cpu is mostly idle. + The linux kernel seems to think that checking for constant and + reliable is enough to trust the counter so we do the same. If this test is not good enough, I don't know what we'll do. Maybe fallback on erts_sys_hrtime always, but that would be a shame as rdtsc is about 3 times faster than hrtime... */ - return ETHR_X86_RUNTIME_CONF_HAVE_RDTSCP__; + return ETHR_X86_RUNTIME_CONF_HAVE_CONSTANT_TSC__ && + ETHR_X86_RUNTIME_CONF_HAVE_TSC_RELIABLE__; #else return 0; #endif |