mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 22:39:18 +02:00
Added signal time and call count debugging
This commit is contained in:
parent
1ad1aee11f
commit
faf9b75487
2 changed files with 15 additions and 1 deletions
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "ScriptObjectV8Proxy.h"
|
#include "ScriptObjectV8Proxy.h"
|
||||||
|
|
||||||
|
#include <QElapsedTimer>
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <QtCore/QSharedPointer>
|
#include <QtCore/QSharedPointer>
|
||||||
|
|
||||||
|
@ -1161,7 +1162,15 @@ int ScriptSignalV8Proxy::qt_metacall(QMetaObject::Call call, int id, void** argu
|
||||||
if (id != 0 || call != QMetaObject::InvokeMetaMethod) {
|
if (id != 0 || call != QMetaObject::InvokeMetaMethod) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_callCounter++;
|
||||||
|
if (_callCounter % 10 == 0) {
|
||||||
|
qDebug() << "Script engine: " << _engine->manager()->getFilename() << " Signal proxy " << fullName()
|
||||||
|
<< " call count: " << _callCounter << " total time: " << _totalCallTime_s;
|
||||||
|
}
|
||||||
|
QElapsedTimer callTimer;
|
||||||
|
callTimer.start();
|
||||||
|
|
||||||
auto isolate = _engine->getIsolate();
|
auto isolate = _engine->getIsolate();
|
||||||
v8::Locker locker(isolate);
|
v8::Locker locker(isolate);
|
||||||
v8::Isolate::Scope isolateScope(isolate);
|
v8::Isolate::Scope isolateScope(isolate);
|
||||||
|
@ -1251,6 +1260,8 @@ int ScriptSignalV8Proxy::qt_metacall(QMetaObject::Call call, int id, void** argu
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_totalCallTime_s += callTimer.elapsed() / 1000.0;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,6 +257,9 @@ private: // storage
|
||||||
bool _isConnected{ false };
|
bool _isConnected{ false };
|
||||||
// Context in which it was created
|
// Context in which it was created
|
||||||
v8::UniquePersistent<v8::Context> _v8Context;
|
v8::UniquePersistent<v8::Context> _v8Context;
|
||||||
|
// Call counter for debugging purposes. It can be used to determine which signals are overwhelming script engine.
|
||||||
|
int _callCounter{0};
|
||||||
|
float _totalCallTime_s{ 0.0 };
|
||||||
|
|
||||||
Q_DISABLE_COPY(ScriptSignalV8Proxy)
|
Q_DISABLE_COPY(ScriptSignalV8Proxy)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue