summaryrefslogtreecommitdiffstats
path: root/src/concurrent/qtconcurrentiteratekernel.h
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2020-04-07 12:34:24 +0200
committerKarsten Heimrich <karsten.heimrich@qt.io>2020-04-09 02:49:18 +0200
commitb75c82f6456edbc00646da15531cfb63f8957817 (patch)
treea11709410f3e2e8f7787eaef8fe1e7f6500ab12f /src/concurrent/qtconcurrentiteratekernel.h
parent9ad8b80fb970cfe96c7c7bae781b20528b2ce334 (diff)
Resolve Qt6 TODO items, replace Median and BlockSizeManager
* Replaces the, only internaly used, implementation of template class Median with a fixed size none templated version. * Replaces BlockSizeManager with an updated BlockSizeManager V2, but keeping the original name. * adapt the auto-test to take the fixed size array into account Change-Id: If76cb944676c4a06a7566ad0bc37ded25b81c70c Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src/concurrent/qtconcurrentiteratekernel.h')
-rw-r--r--src/concurrent/qtconcurrentiteratekernel.h38
1 files changed, 7 insertions, 31 deletions
diff --git a/src/concurrent/qtconcurrentiteratekernel.h b/src/concurrent/qtconcurrentiteratekernel.h
index 3095c9ff52..09009efedc 100644
--- a/src/concurrent/qtconcurrentiteratekernel.h
+++ b/src/concurrent/qtconcurrentiteratekernel.h
@@ -61,37 +61,13 @@ namespace QtConcurrent {
reserve and process at a time. This is done by measuring the time spent
in the user code versus the control part code, and then increasing
the block size if the ratio between them is to small. The block size
- management is done on the basis of the median of several timing measuremens,
- and it is done induvidualy for each thread.
+ management is done on the basis of the median of several timing measurements,
+ and it is done individually for each thread.
*/
class Q_CONCURRENT_EXPORT BlockSizeManager
{
public:
- BlockSizeManager(int iterationCount);
- void timeBeforeUser();
- void timeAfterUser();
- int blockSize();
-private:
- inline bool blockSizeMaxed()
- {
- return (m_blockSize >= maxBlockSize);
- }
-
- const int maxBlockSize;
- qint64 beforeUser;
- qint64 afterUser;
- Median<double> controlPartElapsed;
- Median<double> userPartElapsed;
- int m_blockSize;
-
- Q_DISABLE_COPY(BlockSizeManager)
-};
-
-// ### Qt6: Replace BlockSizeManager with V2 implementation
-class Q_CONCURRENT_EXPORT BlockSizeManagerV2
-{
-public:
- explicit BlockSizeManagerV2(int iterationCount);
+ explicit BlockSizeManager(int iterationCount);
void timeBeforeUser();
void timeAfterUser();
@@ -106,11 +82,11 @@ private:
const int maxBlockSize;
qint64 beforeUser;
qint64 afterUser;
- MedianDouble controlPartElapsed;
- MedianDouble userPartElapsed;
+ Median controlPartElapsed;
+ Median userPartElapsed;
int m_blockSize;
- Q_DISABLE_COPY(BlockSizeManagerV2)
+ Q_DISABLE_COPY(BlockSizeManager)
};
template <typename T>
@@ -221,7 +197,7 @@ public:
ThreadFunctionResult forThreadFunction()
{
- BlockSizeManagerV2 blockSizeManager(iterationCount);
+ BlockSizeManager blockSizeManager(iterationCount);
ResultReporter<T> resultReporter(this);
for(;;) {