Showing the changes to libraries/script-engine/src/ScriptManager.cpp (1 of 3 files). Show all
Unified · Split
| @@ -1049,6 +1049,14 @@ void ScriptManager::timerFired() { · 1048 unmodified lines | ||
| 1049 | 1049 | return; // bail early |
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | + _timerCallCounter++; | |
| 1053 | + if (_timerCallCounter % 100 == 0) { | |
| 1054 | + qDebug() << "Script engine: " << _engine->manager()->getFilename() | |
| 1055 | + << "timer call count: " << _timerCallCounter << " total time: " << _totalTimeInTimerEvents_s; | |
| 1056 | + } | |
| 1057 | + QElapsedTimer callTimer; | |
| 1058 | + callTimer.start(); | |
| 1059 | + | |
| 1052 | 1060 | QTimer* callingTimer = reinterpret_cast<QTimer*>(sender()); |
| 1053 | 1061 | CallbackData timerData = _timerFunctionMap.value(callingTimer); |
| 1054 | 1062 | |
| @@ -1069,6 +1077,8 @@ void ScriptManager::timerFired() { · 14 unmodified lines | ||
| 1069 | 1077 | } else { |
| 1070 | 1078 | qCWarning(scriptengine) << "timerFired -- invalid function" << timerData.function.toVariant().toString(); |
| 1071 | 1079 | } |
| 1080 | + | |
| 1081 | + _totalTimeInTimerEvents_s += callTimer.elapsed() / 1000.0; | |
| 1072 | 1082 | } |
| 1073 | 1083 | |
| 1074 | 1084 | QTimer* ScriptManager::setupTimerWithInterval(const ScriptValue& function, int intervalMS, bool isSingleShot) { |