summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-11-15 16:37:45 +0530
committerDennis Francis <dennis.francis@collabora.co.uk>2017-11-21 16:09:43 +0530
commit4defacd1fa2be800f3e7258abbb4ef2cd1834d31 (patch)
treee0af263eec8141029fb583cb51ad8b607e3a1025 /tools
parentfbcdce22bce6d6d1ba5a9e90b642ea08fc09916a (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')
-rw-r--r--tools/source/misc/cpuid.cxx11
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;
+}
+
}
}