diff options
author | Dennis Francis <dennis.francis@collabora.co.uk> | 2017-11-15 16:37:45 +0530 |
---|---|---|
committer | Dennis Francis <dennis.francis@collabora.co.uk> | 2017-11-21 16:09:43 +0530 |
commit | 4defacd1fa2be800f3e7258abbb4ef2cd1834d31 (patch) | |
tree | e0af263eec8141029fb583cb51ad8b607e3a1025 /tools/source | |
parent | fbcdce22bce6d6d1ba5a9e90b642ea08fc09916a (diff) |
halve the number of threads if HT is active
added hasHyperThreading() function to tools::cpuid
to detect hyperthreading.
Change-Id: I13fab4b6c649e681c329b7e3f4c9f36bda879d84
Diffstat (limited to 'tools/source')
-rw-r--r-- | tools/source/misc/cpuid.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/source/misc/cpuid.cxx b/tools/source/misc/cpuid.cxx index 1518dfc175c4..e3ba82dffda5 100644 --- a/tools/source/misc/cpuid.cxx +++ b/tools/source/misc/cpuid.cxx @@ -16,8 +16,6 @@ namespace tools namespace cpuid { -#if defined(LO_SSE2_AVAILABLE) - namespace { #if defined(_MSC_VER) @@ -35,6 +33,8 @@ void getCpuId(uint32_t array[4]) #endif } +#if defined(LO_SSE2_AVAILABLE) + bool hasSSE2() { uint32_t cpuInfoArray[] = {0, 0, 0, 0}; @@ -48,6 +48,13 @@ bool hasSSE2() { return false; } #endif +bool hasHyperThreading() +{ + uint32_t cpuInfoArray[] = {0, 0, 0, 0}; + getCpuId(cpuInfoArray); + return (cpuInfoArray[3] & (1 << 28)) != 0; +} + } } |