From ceb69e778aad5ba588d722e2bfa44356459f6ecc Mon Sep 17 00:00:00 2001 From: JoergAtGithub Date: Mon, 23 May 2022 20:36:35 +0200 Subject: [PATCH 1/3] Added Trace for the mapping connections, to allow JS profiling. --- src/controllers/scripting/legacy/scriptconnection.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/controllers/scripting/legacy/scriptconnection.cpp b/src/controllers/scripting/legacy/scriptconnection.cpp index 2f66346db3f..24831293f72 100644 --- a/src/controllers/scripting/legacy/scriptconnection.cpp +++ b/src/controllers/scripting/legacy/scriptconnection.cpp @@ -1,8 +1,12 @@ #include "controllers/scripting/legacy/scriptconnection.h" #include "controllers/scripting/legacy/controllerscriptenginelegacy.h" +#include "util/trace.h" void ScriptConnection::executeCallback(double value) const { + std::unique_ptr pCallCallbackTrace; + pCallCallbackTrace = std::make_unique( + QString("JS " + key.item + " callback").toStdString().c_str()); QJSValueList args; args << QJSValue(value); args << QJSValue(key.group); From 0d38845a965a4d80edd6199a48f5253e80a42e3e Mon Sep 17 00:00:00 2001 From: JoergAtGithub Date: Wed, 25 May 2022 19:19:17 +0200 Subject: [PATCH 2/3] Move Trace from heap to stack --- src/controllers/scripting/legacy/scriptconnection.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/controllers/scripting/legacy/scriptconnection.cpp b/src/controllers/scripting/legacy/scriptconnection.cpp index 37c3b06bbce..496d38d34c1 100644 --- a/src/controllers/scripting/legacy/scriptconnection.cpp +++ b/src/controllers/scripting/legacy/scriptconnection.cpp @@ -4,9 +4,7 @@ #include "util/trace.h" void ScriptConnection::executeCallback(double value) const { - std::unique_ptr pCallCallbackTrace; - pCallCallbackTrace = std::make_unique( - QString("JS " + key.item + " callback").toStdString().c_str()); + Trace executeCallbackTrace(QString("JS " + key.item + " callback").toStdString().c_str()); const auto args = QJSValueList{ value, key.group, From ed819cbd15d5f517584bc0cc24f39d64fbf90fc6 Mon Sep 17 00:00:00 2001 From: JoergAtGithub Date: Wed, 25 May 2022 20:04:12 +0200 Subject: [PATCH 3/3] Use %1 and argument for string building, to minimize performance impact of Trace in normal mode --- src/controllers/scripting/legacy/scriptconnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/scripting/legacy/scriptconnection.cpp b/src/controllers/scripting/legacy/scriptconnection.cpp index 496d38d34c1..f97f33e822b 100644 --- a/src/controllers/scripting/legacy/scriptconnection.cpp +++ b/src/controllers/scripting/legacy/scriptconnection.cpp @@ -4,7 +4,7 @@ #include "util/trace.h" void ScriptConnection::executeCallback(double value) const { - Trace executeCallbackTrace(QString("JS " + key.item + " callback").toStdString().c_str()); + Trace executeCallbackTrace("JS %1 callback", key.item); const auto args = QJSValueList{ value, key.group,