From bda52c33e615e6be9210d041e4196854d5fef7d0 Mon Sep 17 00:00:00 2001 From: samcake Date: Thu, 22 Jun 2017 15:35:00 -0700 Subject: [PATCH] Adding the function source when profiling, to explore perf issues --- libraries/script-engine/src/ScriptEngine.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 67b16df1ce..d14df662e2 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -1284,7 +1284,8 @@ void ScriptEngine::timerFired() { // call the associated JS function, if it exists if (timerData.function.isValid()) { - PROFILE_RANGE(script, __FUNCTION__); + //PROFILE_RANGE(script, __FUNCTION__); + PROFILE_RANGE(script, timerData.function.toString().toStdString().c_str()); auto preTimer = p_high_resolution_clock::now(); callWithEnvironment(timerData.definingEntityIdentifier, timerData.definingSandboxURL, timerData.function, timerData.function, QScriptValueList()); auto postTimer = p_high_resolution_clock::now(); @@ -1311,6 +1312,7 @@ QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int // make sure the timer stops when the script does connect(this, &ScriptEngine::scriptEnding, newTimer, &QTimer::stop); + CallbackData timerData = { function, currentEntityIdentifier, currentSandboxURL }; _timerFunctionMap.insert(newTimer, timerData);