From c6520af83e8382162897b699e0538189afc9a851 Mon Sep 17 00:00:00 2001 From: Adeel Asghar Date: Fri, 1 Jul 2016 03:42:02 +0200 Subject: [PATCH] Measure the correct time of API calls. --- Compiler/Template/GenerateAPIFunctionsTpl.tpl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Compiler/Template/GenerateAPIFunctionsTpl.tpl b/Compiler/Template/GenerateAPIFunctionsTpl.tpl index 5a605101688..45c7eb17bff 100644 --- a/Compiler/Template/GenerateAPIFunctionsTpl.tpl +++ b/Compiler/Template/GenerateAPIFunctionsTpl.tpl @@ -384,25 +384,27 @@ template getQtInterfaceFunc(String name, list args, DAE.Type res, S << <%getQtInterfaceHeader(name, '<%className%>', args, res, className, false)%> { + QTime commandTime; + commandTime.start(); + emit logCommand("<%replaceDotAndUnderscore(name)%>("+<%if intGt(listLength(args), 0) then commandArgs else 'QString("")'%>+")", &commandTime); + <%varDecl%> try { MMC_TRY_TOP_INTERNAL() - QTime commandTime; - commandTime.start(); - emit logCommand("<%replaceDotAndUnderscore(name)%>("+<%if intGt(listLength(args), 0) then commandArgs else 'QString("")'%>+")", &commandTime); st = omc_OpenModelicaScriptingAPI_<%replaceDotAndUnderscore(name)%>(threadData, st<%inArgs%><%outArgs%>); <%postCall%> - QString responseLog; - <%responseLog%> - emit logResponse(responseLog, &commandTime); MMC_CATCH_TOP() } catch(std::exception &exception) { emit throwException(QString("<%replaceDotAndUnderscore(name)%> failed. %1").arg(exception.what())); } + QString responseLog; + <%responseLog%> + emit logResponse(responseLog, &commandTime); + <%if outArgs then "return result;"%> } >>