mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 04:07:11 +02:00
Added script timers performance debugging
This commit is contained in:
parent
faf9b75487
commit
b554fc70ea
3 changed files with 15 additions and 0 deletions
|
@ -1049,6 +1049,14 @@ void ScriptManager::timerFired() {
|
|||
return; // bail early
|
||||
}
|
||||
|
||||
_timerCallCounter++;
|
||||
if (_timerCallCounter % 100 == 0) {
|
||||
qDebug() << "Script engine: " << _engine->manager()->getFilename()
|
||||
<< "timer call count: " << _timerCallCounter << " total time: " << _totalTimeInTimerEvents_s;
|
||||
}
|
||||
QElapsedTimer callTimer;
|
||||
callTimer.start();
|
||||
|
||||
QTimer* callingTimer = reinterpret_cast<QTimer*>(sender());
|
||||
CallbackData timerData = _timerFunctionMap.value(callingTimer);
|
||||
|
||||
|
@ -1069,6 +1077,8 @@ void ScriptManager::timerFired() {
|
|||
} else {
|
||||
qCWarning(scriptengine) << "timerFired -- invalid function" << timerData.function.toVariant().toString();
|
||||
}
|
||||
|
||||
_totalTimeInTimerEvents_s += callTimer.elapsed() / 1000.0;
|
||||
}
|
||||
|
||||
QTimer* ScriptManager::setupTimerWithInterval(const ScriptValue& function, int intervalMS, bool isSingleShot) {
|
||||
|
|
|
@ -1005,6 +1005,10 @@ protected:
|
|||
|
||||
QWeakPointer<ScriptEngines> _scriptEngines;
|
||||
|
||||
// For debugging performance issues
|
||||
int _timerCallCounter{ 0 };
|
||||
double _totalTimeInTimerEvents_s{ 0.0 };
|
||||
|
||||
friend ScriptManagerPointer newScriptManager(Context context, const QString& scriptContents, const QString& fileNameString);
|
||||
};
|
||||
|
||||
|
|
|
@ -415,6 +415,7 @@ ScriptEngineV8::ScriptEngineV8(ScriptManager* scriptManager) :
|
|||
v8::V8::Initialize(); qCDebug(scriptengine) << "V8 platform initialized";
|
||||
} );
|
||||
_v8InitMutex.unlock();
|
||||
qDebug() << "Creating new script engine";
|
||||
{
|
||||
v8::Isolate::CreateParams isolateParams;
|
||||
isolateParams.array_buffer_allocator = v8::ArrayBuffer::Allocator::NewDefaultAllocator();
|
||||
|
|
Loading…
Reference in a new issue