summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-11-15 17:09:08 +0530
committerDennis Francis <dennis.francis@collabora.co.uk>2017-11-21 13:49:53 +0530
commitc44c82d692b2df6b0c8767ce10092b0dda952b22 (patch)
tree91961d56a75997f9424895a2f1933eb0872d71eb
parentb473824819a6726d0a2438699984a2a6010e55b7 (diff)
halve thread count if HT active for group interpreter too
Change-Id: Iacc93122191152183127500a4172358a14e96c8b
-rw-r--r--sc/source/core/data/formulacell.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 12cbd1493bee..e68325c59e0e 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -49,6 +49,7 @@
#include <tokenarray.hxx>
#include <comphelper/threadpool.hxx>
+#include <tools/cpuid.hxx>
#include <formula/errorcodes.hxx>
#include <formula/vectortoken.hxx>
#include <svl/intitem.hxx>
@@ -4360,6 +4361,8 @@ bool ScFormulaCell::InterpretFormulaGroup()
return false;
}
+ static bool bHyperThreadingActive = tools::cpuid::hasHyperThreading();
+
// Then do the threaded calculation
class Executor : public comphelper::ThreadTask
@@ -4404,6 +4407,9 @@ bool ScFormulaCell::InterpretFormulaGroup()
comphelper::ThreadPool& rThreadPool(comphelper::ThreadPool::getSharedOptimalPool());
sal_Int32 nThreadCount = rThreadPool.getWorkerCount();
+ if ( bHyperThreadingActive && nThreadCount >= 2 )
+ nThreadCount /= 2;
+
SAL_INFO("sc.threaded", "Running " << nThreadCount << " threads");
{