From 028e822aa4c1df7a718387002744c60ee77ec047 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Wed, 24 Jun 2020 08:15:06 +0100 Subject: [PATCH] Edit User metric warning if use sample() function .. its much faster to vectorize and use the samples() function in init or value function when working with user metrics. for example this code: sample { work <- work + (POWER * recIntSecs); } value { work; } count { Duration; } should be refactored to: value { work <- sum(samples(power) * recIntSecs); } count { Duration; } --- src/Charts/LTMTool.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Charts/LTMTool.cpp b/src/Charts/LTMTool.cpp index 9d8631619..c0adfd326 100644 --- a/src/Charts/LTMTool.cpp +++ b/src/Charts/LTMTool.cpp @@ -2725,6 +2725,8 @@ DataFilterEdit::checkErrors() QStringList errors = checker.check(toPlainText()); checker.colorSyntax(document(), textCursor().position()); // syntax + error highlighting + if (checker.rt.functions.contains("sample")) errors << tr("Warning: sample() is slow -- update code to use samples()"); + // even if no errors need to tell folks emit syntaxErrors(errors); }