| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | __attribute__((visibility("default"))) bool qt_disable_lowpriority_timers=false; | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | QTimerInfoList::QTimerInfoList() | - |
| 19 | { | - |
| 20 | | - |
| 21 | if (!QElapsedTimer::isMonotonic()) { partially evaluated: !QElapsedTimer::isMonotonic()| no Evaluation Count:0 | yes Evaluation Count:1717532 |
| 0-1717532 |
| 22 | | - |
| 23 | previousTime = qt_gettime(); | - |
| 24 | | - |
| 25 | tms unused; | - |
| 26 | previousTicks = times(&unused); | - |
| 27 | | - |
| 28 | ticksPerSecond = sysconf(_SC_CLK_TCK); | - |
| 29 | msPerTick = 1000/ticksPerSecond; | - |
| 30 | } else { | 0 |
| 31 | | - |
| 32 | previousTime.tv_sec = previousTime.tv_usec = 0; | - |
| 33 | previousTicks = 0; | - |
| 34 | ticksPerSecond = 0; | - |
| 35 | msPerTick = 0; | - |
| 36 | } executed: }Execution Count:1717531 | 1717531 |
| 37 | | - |
| 38 | | - |
| 39 | firstTimerInfo = 0; | - |
| 40 | } executed: }Execution Count:1717531 | 1717531 |
| 41 | | - |
| 42 | timeval QTimerInfoList::updateCurrentTime() | - |
| 43 | { | - |
| 44 | return (currentTime = qt_gettime()); executed: return (currentTime = qt_gettime());Execution Count:1062167 | 1062167 |
| 45 | } | - |
| 46 | | - |
| 47 | | - |
| 48 | | - |
| 49 | template <> | - |
| 50 | timeval qAbs(const timeval &t) | - |
| 51 | { | - |
| 52 | timeval tmp = t; | - |
| 53 | if (tmp.tv_sec < 0) { never evaluated: tmp.tv_sec < 0 | 0 |
| 54 | tmp.tv_sec = -tmp.tv_sec - 1; | - |
| 55 | tmp.tv_usec -= 1000000; | - |
| 56 | } | 0 |
| 57 | if (tmp.tv_sec == 0 && tmp.tv_usec < 0) { never evaluated: tmp.tv_sec == 0 never evaluated: tmp.tv_usec < 0 | 0 |
| 58 | tmp.tv_usec = -tmp.tv_usec; | - |
| 59 | } | 0 |
| 60 | return normalizedTimeval(tmp); never executed: return normalizedTimeval(tmp); | 0 |
| 61 | } | - |
| 62 | bool QTimerInfoList::timeChanged(timeval *delta) | - |
| 63 | { | - |
| 64 | | - |
| 65 | | - |
| 66 | | - |
| 67 | | - |
| 68 | struct tms unused; | - |
| 69 | clock_t currentTicks = times(&unused); | - |
| 70 | | - |
| 71 | clock_t elapsedTicks = currentTicks - previousTicks; | - |
| 72 | timeval elapsedTime = currentTime - previousTime; | - |
| 73 | | - |
| 74 | timeval elapsedTimeTicks; | - |
| 75 | elapsedTimeTicks.tv_sec = elapsedTicks / ticksPerSecond; | - |
| 76 | elapsedTimeTicks.tv_usec = (((elapsedTicks * 1000) / ticksPerSecond) % 1000) * 1000; | - |
| 77 | | - |
| 78 | timeval dummy; | - |
| 79 | if (!delta) | 0 |
| 80 | delta = &dummy; never executed: delta = &dummy; | 0 |
| 81 | *delta = elapsedTime - elapsedTimeTicks; | - |
| 82 | | - |
| 83 | previousTicks = currentTicks; | - |
| 84 | previousTime = currentTime; | - |
| 85 | | - |
| 86 | | - |
| 87 | | - |
| 88 | timeval tickGranularity; | - |
| 89 | tickGranularity.tv_sec = 0; | - |
| 90 | tickGranularity.tv_usec = msPerTick * 1000; | - |
| 91 | return elapsedTimeTicks < ((qAbs(*delta) - tickGranularity) * 10); never executed: return elapsedTimeTicks < ((qAbs(*delta) - tickGranularity) * 10); | 0 |
| 92 | } | - |
| 93 | | - |
| 94 | | - |
| 95 | | - |
| 96 | | - |
| 97 | void QTimerInfoList::timerRepair(const timeval &diff) | - |
| 98 | { | - |
| 99 | | - |
| 100 | for (int i = 0; i < size(); ++i) { never evaluated: i < size() | 0 |
| 101 | register QTimerInfo *t = at(i); | - |
| 102 | t->timeout = t->timeout + diff; | - |
| 103 | } | 0 |
| 104 | } | 0 |
| 105 | | - |
| 106 | void QTimerInfoList::repairTimersIfNeeded() | - |
| 107 | { | - |
| 108 | if (QElapsedTimer::isMonotonic()) partially evaluated: QElapsedTimer::isMonotonic()| yes Evaluation Count:667496 | no Evaluation Count:0 |
| 0-667496 |
| 109 | return; executed: return;Execution Count:667493 | 667493 |
| 110 | timeval delta; | - |
| 111 | if (timeChanged(&delta)) never evaluated: timeChanged(&delta) | 0 |
| 112 | timerRepair(delta); never executed: timerRepair(delta); | 0 |
| 113 | } | 0 |
| 114 | void QTimerInfoList::timerInsert(QTimerInfo *ti) | - |
| 115 | { | - |
| 116 | int index = size(); | - |
| 117 | while (index--) { evaluated: index--| yes Evaluation Count:319711 | yes Evaluation Count:63534 |
| 63534-319711 |
| 118 | register const QTimerInfo * const t = at(index); | - |
| 119 | if (!(ti->timeout < t->timeout)) evaluated: !(ti->timeout < t->timeout)| yes Evaluation Count:111022 | yes Evaluation Count:208689 |
| 111022-208689 |
| 120 | break; executed: break;Execution Count:111022 | 111022 |
| 121 | } executed: }Execution Count:208689 | 208689 |
| 122 | insert(index+1, ti); | - |
| 123 | } executed: }Execution Count:174556 | 174556 |
| 124 | | - |
| 125 | inline timeval &operator+=(timeval &t1, int ms) | - |
| 126 | { | - |
| 127 | t1.tv_sec += ms / 1000; | - |
| 128 | t1.tv_usec += ms % 1000 * 1000; | - |
| 129 | return normalizedTimeval(t1); executed: return normalizedTimeval(t1);Execution Count:211189 | 211189 |
| 130 | } | - |
| 131 | | - |
| 132 | inline timeval operator+(const timeval &t1, int ms) | - |
| 133 | { | - |
| 134 | timeval t2 = t1; | - |
| 135 | return t2 += ms; executed: return t2 += ms;Execution Count:132417 | 132417 |
| 136 | } | - |
| 137 | | - |
| 138 | static timeval roundToMillisecond(timeval val) | - |
| 139 | { | - |
| 140 | | - |
| 141 | | - |
| 142 | | - |
| 143 | int us = val.tv_usec % 1000; | - |
| 144 | val.tv_usec += 1000 - us; | - |
| 145 | return normalizedTimeval(val); executed: return normalizedTimeval(val);Execution Count:263163 | 263163 |
| 146 | } | - |
| 147 | static void calculateCoarseTimerTimeout(QTimerInfo *t, timeval currentTime) | - |
| 148 | { | - |
| 149 | register uint interval = uint(t->interval); | - |
| 150 | register uint msec = uint(t->timeout.tv_usec) / 1000; | - |
| 151 | qt_noop(); | - |
| 152 | | - |
| 153 | | - |
| 154 | uint absMaxRounding = interval / 20; | - |
| 155 | | - |
| 156 | if (interval < 100 && interval != 25 && interval != 50 && interval != 75) { evaluated: interval < 100| yes Evaluation Count:1353 | yes Evaluation Count:8100 |
partially evaluated: interval != 25| yes Evaluation Count:1353 | no Evaluation Count:0 |
evaluated: interval != 50| yes Evaluation Count:1346 | yes Evaluation Count:7 |
partially evaluated: interval != 75| yes Evaluation Count:1346 | no Evaluation Count:0 |
| 0-8100 |
| 157 | | - |
| 158 | if (interval < 50) { evaluated: interval < 50| yes Evaluation Count:1329 | yes Evaluation Count:17 |
| 17-1329 |
| 159 | | - |
| 160 | | - |
| 161 | register bool roundUp = (msec % 50) >= 25; | - |
| 162 | msec >>= 1; | - |
| 163 | msec |= uint(roundUp); | - |
| 164 | msec <<= 1; | - |
| 165 | } else { executed: }Execution Count:1329 | 1329 |
| 166 | | - |
| 167 | | - |
| 168 | register bool roundUp = (msec % 100) >= 50; | - |
| 169 | msec >>= 2; | - |
| 170 | msec |= uint(roundUp); | - |
| 171 | msec <<= 2; | - |
| 172 | } executed: }Execution Count:17 | 17 |
| 173 | } else { | - |
| 174 | uint min = qMax<int>(0, msec - absMaxRounding); | - |
| 175 | uint max = qMin(1000u, msec + absMaxRounding); | - |
| 176 | | - |
| 177 | | - |
| 178 | | - |
| 179 | | - |
| 180 | if (min == 0) { evaluated: min == 0| yes Evaluation Count:1238 | yes Evaluation Count:6869 |
| 1238-6869 |
| 181 | msec = 0; | - |
| 182 | goto recalculate; executed: goto recalculate;Execution Count:1238 | 1238 |
| 183 | } else if (max == 1000) { evaluated: max == 1000| yes Evaluation Count:393 | yes Evaluation Count:6476 |
| 393-6476 |
| 184 | msec = 1000; | - |
| 185 | goto recalculate; executed: goto recalculate;Execution Count:393 | 393 |
| 186 | } | - |
| 187 | | - |
| 188 | uint wantedBoundaryMultiple; | - |
| 189 | | - |
| 190 | | - |
| 191 | | - |
| 192 | | - |
| 193 | | - |
| 194 | if ((interval % 500) == 0) { evaluated: (interval % 500) == 0| yes Evaluation Count:4482 | yes Evaluation Count:1994 |
| 1994-4482 |
| 195 | if (interval >= 5000) { evaluated: interval >= 5000| yes Evaluation Count:228 | yes Evaluation Count:4254 |
| 228-4254 |
| 196 | msec = msec >= 500 ? max : min; evaluated: msec >= 500| yes Evaluation Count:168 | yes Evaluation Count:60 |
| 60-168 |
| 197 | goto recalculate; executed: goto recalculate;Execution Count:228 | 228 |
| 198 | } else { | - |
| 199 | wantedBoundaryMultiple = 500; | - |
| 200 | } executed: }Execution Count:4254 | 4254 |
| 201 | } else if ((interval % 50) == 0) { evaluated: (interval % 50) == 0| yes Evaluation Count:1986 | yes Evaluation Count:8 |
| 8-1986 |
| 202 | | - |
| 203 | uint mult50 = interval / 50; | - |
| 204 | if ((mult50 % 4) == 0) { evaluated: (mult50 % 4) == 0| yes Evaluation Count:903 | yes Evaluation Count:1083 |
| 903-1083 |
| 205 | | - |
| 206 | wantedBoundaryMultiple = 200; | - |
| 207 | } else if ((mult50 % 2) == 0) { evaluated: (mult50 % 2) == 0| yes Evaluation Count:1023 | yes Evaluation Count:60 |
executed: }Execution Count:903 | 60-1023 |
| 208 | | - |
| 209 | wantedBoundaryMultiple = 100; | - |
| 210 | } else if ((mult50 % 5) == 0) { evaluated: (mult50 % 5) == 0| yes Evaluation Count:6 | yes Evaluation Count:54 |
executed: }Execution Count:1023 | 6-1023 |
| 211 | | - |
| 212 | wantedBoundaryMultiple = 250; | - |
| 213 | } else { executed: }Execution Count:6 | 6 |
| 214 | | - |
| 215 | wantedBoundaryMultiple = 50; | - |
| 216 | } executed: }Execution Count:54 | 54 |
| 217 | } else { | - |
| 218 | wantedBoundaryMultiple = 25; | - |
| 219 | } executed: }Execution Count:8 | 8 |
| 220 | | - |
| 221 | uint base = msec / wantedBoundaryMultiple * wantedBoundaryMultiple; | - |
| 222 | uint middlepoint = base + wantedBoundaryMultiple / 2; | - |
| 223 | if (msec < middlepoint) evaluated: msec < middlepoint| yes Evaluation Count:3594 | yes Evaluation Count:2654 |
| 2654-3594 |
| 224 | msec = qMax(base, min); executed: msec = qMax(base, min);Execution Count:3594 | 3594 |
| 225 | else | - |
| 226 | msec = qMin(base + wantedBoundaryMultiple, max); executed: msec = qMin(base + wantedBoundaryMultiple, max);Execution Count:2654 | 2654 |
| 227 | } | - |
| 228 | | - |
| 229 | recalculate: code before this statement executed: recalculate:Execution Count:7594 | 7594 |
| 230 | if (msec == 1000u) { evaluated: msec == 1000u| yes Evaluation Count:393 | yes Evaluation Count:9060 |
| 393-9060 |
| 231 | ++t->timeout.tv_sec; | - |
| 232 | t->timeout.tv_usec = 0; | - |
| 233 | } else { executed: }Execution Count:393 | 393 |
| 234 | t->timeout.tv_usec = msec * 1000; | - |
| 235 | } executed: }Execution Count:9060 | 9060 |
| 236 | | - |
| 237 | if (t->timeout < currentTime) partially evaluated: t->timeout < currentTime| no Evaluation Count:0 | yes Evaluation Count:9453 |
| 0-9453 |
| 238 | t->timeout += interval; never executed: t->timeout += interval; | 0 |
| 239 | } executed: }Execution Count:9453 | 9453 |
| 240 | | - |
| 241 | static void calculateNextTimeout(QTimerInfo *t, timeval currentTime) | - |
| 242 | { | - |
| 243 | switch (t->timerType) { | - |
| 244 | case Qt::PreciseTimer: | - |
| 245 | case Qt::CoarseTimer: | - |
| 246 | t->timeout += t->interval; | - |
| 247 | if (t->timeout < currentTime) { evaluated: t->timeout < currentTime| yes Evaluation Count:36769 | yes Evaluation Count:5234 |
| 5234-36769 |
| 248 | t->timeout = currentTime; | - |
| 249 | t->timeout += t->interval; | - |
| 250 | } executed: }Execution Count:36769 | 36769 |
| 251 | | - |
| 252 | | - |
| 253 | | - |
| 254 | | - |
| 255 | | - |
| 256 | | - |
| 257 | | - |
| 258 | if (t->timerType == Qt::CoarseTimer) evaluated: t->timerType == Qt::CoarseTimer| yes Evaluation Count:2276 | yes Evaluation Count:39727 |
| 2276-39727 |
| 259 | calculateCoarseTimerTimeout(t, currentTime); executed: calculateCoarseTimerTimeout(t, currentTime);Execution Count:2276 | 2276 |
| 260 | return; executed: return;Execution Count:42003 | 42003 |
| 261 | | - |
| 262 | case Qt::VeryCoarseTimer: | - |
| 263 | | - |
| 264 | t->timeout.tv_sec += t->interval; | - |
| 265 | if (t->timeout.tv_sec <= currentTime.tv_sec) partially evaluated: t->timeout.tv_sec <= currentTime.tv_sec| no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
| 266 | t->timeout.tv_sec = currentTime.tv_sec + t->interval; never executed: t->timeout.tv_sec = currentTime.tv_sec + t->interval; | 0 |
| 267 | | - |
| 268 | | - |
| 269 | | - |
| 270 | | - |
| 271 | | - |
| 272 | return; executed: return;Execution Count:136 | 136 |
| 273 | } | - |
| 274 | | - |
| 275 | | - |
| 276 | | - |
| 277 | | - |
| 278 | | - |
| 279 | | - |
| 280 | | - |
| 281 | } | 0 |
| 282 | | - |
| 283 | | - |
| 284 | | - |
| 285 | | - |
| 286 | | - |
| 287 | bool QTimerInfoList::timerWait(timeval &tm) | - |
| 288 | { | - |
| 289 | timeval currentTime = updateCurrentTime(); | - |
| 290 | repairTimersIfNeeded(); | - |
| 291 | | - |
| 292 | | - |
| 293 | QTimerInfo *t = 0; | - |
| 294 | for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) { evaluated: it != constEnd()| yes Evaluation Count:301604 | yes Evaluation Count:324962 |
| 301604-324962 |
| 295 | if (!(*it)->activateRef) { evaluated: !(*it)->activateRef| yes Evaluation Count:301591 | yes Evaluation Count:13 |
| 13-301591 |
| 296 | t = *it; | - |
| 297 | break; executed: break;Execution Count:301591 | 301591 |
| 298 | } | - |
| 299 | } executed: }Execution Count:13 | 13 |
| 300 | | - |
| 301 | if (!t) evaluated: !t| yes Evaluation Count:324950 | yes Evaluation Count:301591 |
| 301591-324950 |
| 302 | return false; executed: return false;Execution Count:324944 | 324944 |
| 303 | | - |
| 304 | if (currentTime < t->timeout) { evaluated: currentTime < t->timeout| yes Evaluation Count:263162 | yes Evaluation Count:38429 |
| 38429-263162 |
| 305 | | - |
| 306 | tm = roundToMillisecond(t->timeout - currentTime); | - |
| 307 | } else { executed: }Execution Count:263162 | 263162 |
| 308 | | - |
| 309 | tm.tv_sec = 0; | - |
| 310 | tm.tv_usec = 0; | - |
| 311 | } executed: }Execution Count:38429 | 38429 |
| 312 | | - |
| 313 | return true; executed: return true;Execution Count:301591 | 301591 |
| 314 | } | - |
| 315 | | - |
| 316 | | - |
| 317 | | - |
| 318 | | - |
| 319 | | - |
| 320 | | - |
| 321 | int QTimerInfoList::timerRemainingTime(int timerId) | - |
| 322 | { | - |
| 323 | timeval currentTime = updateCurrentTime(); | - |
| 324 | repairTimersIfNeeded(); | - |
| 325 | timeval tm = {0, 0}; | - |
| 326 | | - |
| 327 | for (int i = 0; i < count(); ++i) { partially evaluated: i < count()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 328 | register QTimerInfo *t = at(i); | - |
| 329 | if (t->id == timerId) { partially evaluated: t->id == timerId| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 330 | if (currentTime < t->timeout) { partially evaluated: currentTime < t->timeout| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 331 | | - |
| 332 | tm = roundToMillisecond(t->timeout - currentTime); | - |
| 333 | return tm.tv_sec*1000 + tm.tv_usec/1000; executed: return tm.tv_sec*1000 + tm.tv_usec/1000;Execution Count:1 | 1 |
| 334 | } else { | - |
| 335 | return 0; never executed: return 0; | 0 |
| 336 | } | - |
| 337 | } | - |
| 338 | } | 0 |
| 339 | | - |
| 340 | | - |
| 341 | | - |
| 342 | | - |
| 343 | | - |
| 344 | return -1; never executed: return -1; | 0 |
| 345 | } | - |
| 346 | | - |
| 347 | void QTimerInfoList::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) | - |
| 348 | { | - |
| 349 | QTimerInfo *t = new QTimerInfo; | - |
| 350 | t->id = timerId; | - |
| 351 | t->interval = interval; | - |
| 352 | t->timerType = timerType; | - |
| 353 | t->obj = object; | - |
| 354 | t->activateRef = 0; | - |
| 355 | | - |
| 356 | timeval expected = updateCurrentTime() + interval; | - |
| 357 | | - |
| 358 | switch (timerType) { | - |
| 359 | case Qt::PreciseTimer: | - |
| 360 | | - |
| 361 | | - |
| 362 | t->timeout = expected; | - |
| 363 | break; executed: break;Execution Count:876 | 876 |
| 364 | | - |
| 365 | case Qt::CoarseTimer: | - |
| 366 | | - |
| 367 | | - |
| 368 | | - |
| 369 | | - |
| 370 | if (interval >= 20000) { evaluated: interval >= 20000| yes Evaluation Count:4755 | yes Evaluation Count:126785 |
| 4755-126785 |
| 371 | t->timerType = Qt::VeryCoarseTimer; | - |
| 372 | | - |
| 373 | } else { executed: }Execution Count:4755 | 4755 |
| 374 | t->timeout = expected; | - |
| 375 | if (interval <= 20) { evaluated: interval <= 20| yes Evaluation Count:119608 | yes Evaluation Count:7177 |
| 7177-119608 |
| 376 | t->timerType = Qt::PreciseTimer; | - |
| 377 | | - |
| 378 | } else if (interval <= 20000) { partially evaluated: interval <= 20000| yes Evaluation Count:7177 | no Evaluation Count:0 |
executed: }Execution Count:119608 | 0-119608 |
| 379 | calculateCoarseTimerTimeout(t, currentTime); | - |
| 380 | } executed: }Execution Count:7177 | 7177 |
| 381 | break; executed: break;Execution Count:126785 | 126785 |
| 382 | } | - |
| 383 | | - |
| 384 | case Qt::VeryCoarseTimer: code before this statement executed: case Qt::VeryCoarseTimer:Execution Count:4755 | 4755 |
| 385 | | - |
| 386 | | - |
| 387 | t->interval /= 500; | - |
| 388 | t->interval += 1; | - |
| 389 | t->interval >>= 1; | - |
| 390 | t->timeout.tv_sec = currentTime.tv_sec + t->interval; | - |
| 391 | t->timeout.tv_usec = 0; | - |
| 392 | | - |
| 393 | | - |
| 394 | if (currentTime.tv_usec > 500*1000) evaluated: currentTime.tv_usec > 500*1000| yes Evaluation Count:1748 | yes Evaluation Count:3008 |
| 1748-3008 |
| 395 | ++t->timeout.tv_sec; executed: ++t->timeout.tv_sec;Execution Count:1748 | 1748 |
| 396 | } executed: }Execution Count:4756 | 4756 |
| 397 | | - |
| 398 | timerInsert(t); | - |
| 399 | } executed: }Execution Count:132417 | 132417 |
| 400 | | - |
| 401 | bool QTimerInfoList::unregisterTimer(int timerId) | - |
| 402 | { | - |
| 403 | | - |
| 404 | for (int i = 0; i < count(); ++i) { partially evaluated: i < count()| yes Evaluation Count:62560525 | no Evaluation Count:0 |
| 0-62560525 |
| 405 | register QTimerInfo *t = at(i); | - |
| 406 | if (t->id == timerId) { evaluated: t->id == timerId| yes Evaluation Count:129527 | yes Evaluation Count:62430998 |
| 129527-62430998 |
| 407 | | - |
| 408 | removeAt(i); | - |
| 409 | if (t == firstTimerInfo) evaluated: t == firstTimerInfo| yes Evaluation Count:12259 | yes Evaluation Count:117268 |
| 12259-117268 |
| 410 | firstTimerInfo = 0; executed: firstTimerInfo = 0;Execution Count:12259 | 12259 |
| 411 | if (t->activateRef) evaluated: t->activateRef| yes Evaluation Count:12282 | yes Evaluation Count:117245 |
| 12282-117245 |
| 412 | *(t->activateRef) = 0; executed: *(t->activateRef) = 0;Execution Count:12282 | 12282 |
| 413 | delete t; | - |
| 414 | return true; executed: return true;Execution Count:129527 | 129527 |
| 415 | } | - |
| 416 | } executed: }Execution Count:62430998 | 62430998 |
| 417 | | - |
| 418 | return false; never executed: return false; | 0 |
| 419 | } | - |
| 420 | | - |
| 421 | bool QTimerInfoList::unregisterTimers(QObject *object) | - |
| 422 | { | - |
| 423 | if (isEmpty()) evaluated: isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:1179 |
| 2-1179 |
| 424 | return false; executed: return false;Execution Count:2 | 2 |
| 425 | for (int i = 0; i < count(); ++i) { evaluated: i < count()| yes Evaluation Count:3800 | yes Evaluation Count:1179 |
| 1179-3800 |
| 426 | register QTimerInfo *t = at(i); | - |
| 427 | if (t->obj == object) { evaluated: t->obj == object| yes Evaluation Count:1228 | yes Evaluation Count:2572 |
| 1228-2572 |
| 428 | | - |
| 429 | removeAt(i); | - |
| 430 | if (t == firstTimerInfo) partially evaluated: t == firstTimerInfo| no Evaluation Count:0 | yes Evaluation Count:1228 |
| 0-1228 |
| 431 | firstTimerInfo = 0; never executed: firstTimerInfo = 0; | 0 |
| 432 | if (t->activateRef) partially evaluated: t->activateRef| no Evaluation Count:0 | yes Evaluation Count:1228 |
| 0-1228 |
| 433 | *(t->activateRef) = 0; never executed: *(t->activateRef) = 0; | 0 |
| 434 | delete t; | - |
| 435 | | - |
| 436 | --i; | - |
| 437 | } executed: }Execution Count:1228 | 1228 |
| 438 | } executed: }Execution Count:3800 | 3800 |
| 439 | return true; executed: return true;Execution Count:1179 | 1179 |
| 440 | } | - |
| 441 | | - |
| 442 | QList<QAbstractEventDispatcher::TimerInfo> QTimerInfoList::registeredTimers(QObject *object) const | - |
| 443 | { | - |
| 444 | QList<QAbstractEventDispatcher::TimerInfo> list; | - |
| 445 | for (int i = 0; i < count(); ++i) { evaluated: i < count()| yes Evaluation Count:31186 | yes Evaluation Count:23300 |
| 23300-31186 |
| 446 | register const QTimerInfo * const t = at(i); | - |
| 447 | if (t->obj == object) { evaluated: t->obj == object| yes Evaluation Count:9 | yes Evaluation Count:31177 |
| 9-31177 |
| 448 | list << QAbstractEventDispatcher::TimerInfo(t->id, | - |
| 449 | (t->timerType == Qt::VeryCoarseTimer | - |
| 450 | ? t->interval * 1000 | - |
| 451 | : t->interval), | - |
| 452 | t->timerType); | - |
| 453 | } executed: }Execution Count:9 | 9 |
| 454 | } executed: }Execution Count:31186 | 31186 |
| 455 | return list; executed: return list;Execution Count:23301 | 23301 |
| 456 | } | - |
| 457 | | - |
| 458 | | - |
| 459 | | - |
| 460 | | - |
| 461 | int QTimerInfoList::activateTimers() | - |
| 462 | { | - |
| 463 | if (qt_disable_lowpriority_timers || isEmpty()) partially evaluated: qt_disable_lowpriority_timers| no Evaluation Count:0 | yes Evaluation Count:40996 |
evaluated: isEmpty()| yes Evaluation Count:13 | yes Evaluation Count:40983 |
| 0-40996 |
| 464 | return 0; executed: return 0;Execution Count:13 | 13 |
| 465 | | - |
| 466 | int n_act = 0, maxCount = 0; | - |
| 467 | firstTimerInfo = 0; | - |
| 468 | | - |
| 469 | timeval currentTime = updateCurrentTime(); | - |
| 470 | | - |
| 471 | repairTimersIfNeeded(); | - |
| 472 | | - |
| 473 | | - |
| 474 | | - |
| 475 | for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) { evaluated: it != constEnd()| yes Evaluation Count:54292 | yes Evaluation Count:28977 |
| 28977-54292 |
| 476 | if (currentTime < (*it)->timeout) evaluated: currentTime < (*it)->timeout| yes Evaluation Count:12006 | yes Evaluation Count:42286 |
| 12006-42286 |
| 477 | break; executed: break;Execution Count:12006 | 12006 |
| 478 | maxCount++; | - |
| 479 | } executed: }Execution Count:42286 | 42286 |
| 480 | | - |
| 481 | | - |
| 482 | while (maxCount--) { evaluated: maxCount--| yes Evaluation Count:42264 | yes Evaluation Count:40858 |
| 40858-42264 |
| 483 | if (isEmpty()) partially evaluated: isEmpty()| no Evaluation Count:0 | yes Evaluation Count:42264 |
| 0-42264 |
| 484 | break; | 0 |
| 485 | | - |
| 486 | QTimerInfo *currentTimerInfo = first(); | - |
| 487 | if (currentTime < currentTimerInfo->timeout) evaluated: currentTime < currentTimerInfo->timeout| yes Evaluation Count:125 | yes Evaluation Count:42139 |
| 125-42139 |
| 488 | break; executed: break;Execution Count:125 | 125 |
| 489 | | - |
| 490 | if (!firstTimerInfo) { evaluated: !firstTimerInfo| yes Evaluation Count:42110 | yes Evaluation Count:29 |
| 29-42110 |
| 491 | firstTimerInfo = currentTimerInfo; | - |
| 492 | } else if (firstTimerInfo == currentTimerInfo) { partially evaluated: firstTimerInfo == currentTimerInfo| no Evaluation Count:0 | yes Evaluation Count:29 |
executed: }Execution Count:42110 | 0-42110 |
| 493 | | - |
| 494 | break; | 0 |
| 495 | } else if (currentTimerInfo->interval < firstTimerInfo->interval evaluated: currentTimerInfo->interval < firstTimerInfo->interval| yes Evaluation Count:12 | yes Evaluation Count:17 |
| 12-17 |
| 496 | || currentTimerInfo->interval == firstTimerInfo->interval) { evaluated: currentTimerInfo->interval == firstTimerInfo->interval| yes Evaluation Count:1 | yes Evaluation Count:16 |
| 1-16 |
| 497 | firstTimerInfo = currentTimerInfo; | - |
| 498 | } executed: }Execution Count:13 | 13 |
| 499 | | - |
| 500 | | - |
| 501 | removeFirst(); | - |
| 502 | calculateNextTimeout(currentTimerInfo, currentTime); | - |
| 503 | | - |
| 504 | | - |
| 505 | timerInsert(currentTimerInfo); | - |
| 506 | if (currentTimerInfo->interval > 0) evaluated: currentTimerInfo->interval > 0| yes Evaluation Count:5389 | yes Evaluation Count:36750 |
| 5389-36750 |
| 507 | n_act++; executed: n_act++;Execution Count:5389 | 5389 |
| 508 | | - |
| 509 | if (!currentTimerInfo->activateRef) { evaluated: !currentTimerInfo->activateRef| yes Evaluation Count:42121 | yes Evaluation Count:18 |
| 18-42121 |
| 510 | | - |
| 511 | currentTimerInfo->activateRef = ¤tTimerInfo; | - |
| 512 | | - |
| 513 | QTimerEvent e(currentTimerInfo->id); | - |
| 514 | QCoreApplication::sendEvent(currentTimerInfo->obj, &e); | - |
| 515 | | - |
| 516 | if (currentTimerInfo) evaluated: currentTimerInfo| yes Evaluation Count:29839 | yes Evaluation Count:12282 |
| 12282-29839 |
| 517 | currentTimerInfo->activateRef = 0; executed: currentTimerInfo->activateRef = 0;Execution Count:29839 | 29839 |
| 518 | } executed: }Execution Count:42121 | 42121 |
| 519 | } executed: }Execution Count:42139 | 42139 |
| 520 | | - |
| 521 | firstTimerInfo = 0; | - |
| 522 | | - |
| 523 | return n_act; executed: return n_act;Execution Count:40983 | 40983 |
| 524 | } | - |
| 525 | | - |
| 526 | | - |
| 527 | | - |
| | |