qtconcurrentiteratekernel.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/concurrent/qtconcurrentiteratekernel.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11enum {-
12 TargetRatio = 100,-
13 MedianSize = 7-
14};-
15static qint64 getticks()-
16{-
17-
18 clockid_t clockId;-
19-
20-
21-
22-
23-
24 clockId = 0;-
25-
26-
27-
28 static QBasicAtomicInt sUseThreadCpuTime = { -2 };-
29 int useThreadCpuTime = sUseThreadCpuTime.load();-
30 if (useThreadCpuTime == -2
useThreadCpuTime == -2Description
TRUEevaluated 4 times by 4 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
FALSEevaluated 37202 times by 4 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
) {
4-37202
31-
32-
33 useThreadCpuTime = sysconf(_SC_THREAD_CPUTIME) == -1L
sysconf(_SC_TH...PUTIME) == -1LDescription
TRUEnever evaluated
FALSEevaluated 4 times by 4 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
? -1 : 0 ;
0-4
34 sUseThreadCpuTime.store(useThreadCpuTime);-
35 }
executed 4 times by 4 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
4
36 if (useThreadCpuTime != -1
useThreadCpuTime != -1Description
TRUEevaluated 37206 times by 4 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
FALSEnever evaluated
)
0-37206
37 clockId = 3;
executed 37206 times by 4 tests: clockId = 3;
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
37206
38-
39-
40-
41-
42-
43 struct timespec ts;-
44 if (clock_gettime(clockId, &ts) == -1
clock_gettime(...Id, &ts) == -1Description
TRUEnever evaluated
FALSEevaluated 37206 times by 4 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
)
0-37206
45 return
never executed: return 0;
0;
never executed: return 0;
0
46 return
executed 37206 times by 4 tests: return (ts.tv_sec * 1000000000) + ts.tv_nsec;
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
(ts.tv_sec * 1000000000) + ts.tv_nsec;
executed 37206 times by 4 tests: return (ts.tv_sec * 1000000000) + ts.tv_nsec;
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
37206
47-
48-
49-
50-
51-
52-
53-
54}-
55static double elapsed(qint64 after, qint64 before)-
56{-
57 return
executed 37206 times by 4 tests: return double(after - before);
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
double(after - before);
executed 37206 times by 4 tests: return double(after - before);
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
37206
58}-
59-
60namespace QtConcurrent {-
61-
62-
63-
64-
65BlockSizeManager::BlockSizeManager(int iterationCount)-
66: maxBlockSize(iterationCount / (QThreadPool::globalInstance()->maxThreadCount() * 2)),-
67 beforeUser(0), afterUser(0),-
68 controlPartElapsed(MedianSize), userPartElapsed(MedianSize),-
69 m_blockSize(1)-
70{ }
never executed: end of block
0
71-
72-
73void BlockSizeManager::timeBeforeUser()-
74{-
75 if (blockSizeMaxed()
blockSizeMaxed()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
76 return;
never executed: return;
0
77-
78 beforeUser = getticks();-
79 controlPartElapsed.addValue(elapsed(beforeUser, afterUser));-
80}
never executed: end of block
0
81-
82-
83-
84void BlockSizeManager::timeAfterUser()-
85{-
86 if (blockSizeMaxed()
blockSizeMaxed()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
87 return;
never executed: return;
0
88-
89 afterUser = getticks();-
90 userPartElapsed.addValue(elapsed(afterUser, beforeUser));-
91-
92 if (controlPartElapsed.isMedianValid() == false
controlPartEla...lid() == falseDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
93 return;
never executed: return;
0
94-
95 if (controlPartElapsed.median() * TargetRatio < userPartElapsed.median()
controlPartEla...apsed.median()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
96 return;
never executed: return;
0
97-
98 m_blockSize = qMin(m_blockSize * 2, maxBlockSize);-
99-
100-
101-
102-
103-
104-
105-
106 controlPartElapsed.reset();-
107 userPartElapsed.reset();-
108}
never executed: end of block
0
109-
110int BlockSizeManager::blockSize()-
111{-
112 return
never executed: return m_blockSize;
m_blockSize;
never executed: return m_blockSize;
0
113}-
114-
115-
116-
117-
118BlockSizeManagerV2::BlockSizeManagerV2(int iterationCount)-
119 : maxBlockSize(iterationCount / (QThreadPool::globalInstance()->maxThreadCount() * 2)),-
120 beforeUser(0), afterUser(0),-
121 m_blockSize(1)-
122{ }
executed 20972 times by 4 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
20972
123-
124-
125void BlockSizeManagerV2::timeBeforeUser()-
126{-
127 if (blockSizeMaxed()
blockSizeMaxed()Description
TRUEevaluated 560 times by 2 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentmap - unknown status
FALSEevaluated 18603 times by 4 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
)
560-18603
128 return;
executed 560 times by 2 tests: return;
Executed by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentmap - unknown status
560
129-
130 beforeUser = getticks();-
131 controlPartElapsed.addValue(elapsed(beforeUser, afterUser));-
132}
executed 18603 times by 4 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
18603
133-
134-
135-
136void BlockSizeManagerV2::timeAfterUser()-
137{-
138 if (blockSizeMaxed()
blockSizeMaxed()Description
TRUEevaluated 559 times by 2 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentmap - unknown status
FALSEevaluated 18603 times by 4 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
)
559-18603
139 return;
executed 559 times by 2 tests: return;
Executed by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentmap - unknown status
559
140-
141 afterUser = getticks();-
142 userPartElapsed.addValue(elapsed(afterUser, beforeUser));-
143-
144 if (controlPartElapsed.isMedianValid() == false
controlPartEla...lid() == falseDescription
TRUEevaluated 16072 times by 4 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
FALSEevaluated 2531 times by 4 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
)
2531-16072
145 return;
executed 16072 times by 4 tests: return;
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
16072
146-
147 if (controlPartElapsed.median() * TargetRatio < userPartElapsed.median()
controlPartEla...apsed.median()Description
TRUEnever evaluated
FALSEevaluated 2531 times by 4 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
)
0-2531
148 return;
never executed: return;
0
149-
150 m_blockSize = qMin(m_blockSize * 2, maxBlockSize);-
151-
152-
153-
154-
155-
156-
157-
158 controlPartElapsed.reset();-
159 userPartElapsed.reset();-
160}
executed 2531 times by 4 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
2531
161-
162int BlockSizeManagerV2::blockSize()-
163{-
164 return
executed 40039 times by 4 tests: return m_blockSize;
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
m_blockSize;
executed 40039 times by 4 tests: return m_blockSize;
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
40039
165}-
166-
167}-
168-
169-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9