3
0
Fork 0
mirror of https://thingvellir.net/git/overte synced 2025-03-27 23:52:03 +01:00

Add Test.profileRange

This commit is contained in:
Ryan Huffman 2016-12-29 16:48:25 -08:00
parent e181c2a16e
commit 9d4fdfa38a
2 changed files with 9 additions and 0 deletions

View file

@ -134,3 +134,9 @@ void TestScriptingInterface::startTraceEvent(QString name) {
void TestScriptingInterface::endTraceEvent(QString name) {
tracing::traceEvent(trace_test(), name, tracing::DurationEnd);
}
void TestScriptingInterface::profileRange(const QString& name, QScriptValue fn) {
PROFILE_RANGE(script, name);
fn.call();
}

View file

@ -13,6 +13,8 @@
#include <functional>
#include <QtCore/QObject>
class QScriptValue;
class TestScriptingInterface : public QObject {
Q_OBJECT
@ -69,6 +71,7 @@ public slots:
void endTraceEvent(QString name);
Q_INVOKABLE void profileRange(const QString& name, QScriptValue function);
private:
bool waitForCondition(qint64 maxWaitMs, std::function<bool()> condition);