summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionEvaluator.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2022-11-10 19:44:58 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2022-11-11 17:29:41 (GMT)
commit4d70a94545629affd3d68dda74ec71c62a3bb0c4 (patch)
tree8895996ff70d1fd0b391b1fb076d27b7017c57da /Source/cmGeneratorExpressionEvaluator.cxx
parent09d7f947d68796e8fde923a47636f1c764b5a7af (diff)
downloadCMake-4d70a94545629affd3d68dda74ec71c62a3bb0c4.zip
CMake-4d70a94545629affd3d68dda74ec71c62a3bb0c4.tar.gz
CMake-4d70a94545629affd3d68dda74ec71c62a3bb0c4.tar.bz2
Profiling: Profile genex evaluation
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx31
1 files changed, 30 insertions, 1 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index fec309c..b239408 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -4,8 +4,14 @@
#include <sstream>
+#ifndef CMAKE_BOOTSTRAP
+# include <cm3p/json/value.h>
+#endif
+
#include "cmGeneratorExpressionContext.h"
#include "cmGeneratorExpressionNode.h"
+#include "cmLocalGenerator.h"
+#include "cmake.h"
GeneratorExpressionContent::GeneratorExpressionContent(
const char* startContent, size_t length)
@@ -61,6 +67,12 @@ std::string GeneratorExpressionContent::Evaluate(
cmGeneratorExpressionContext* context,
cmGeneratorExpressionDAGChecker* dagChecker) const
{
+#ifndef CMAKE_BOOTSTRAP
+ auto evalProfilingRAII =
+ context->LG->GetCMakeInstance()->CreateProfilingEntry(
+ "genex_eval", this->GetOriginalExpression());
+#endif
+
std::string identifier;
{
for (const auto& pExprEval : this->IdentifierChildren) {
@@ -101,7 +113,24 @@ std::string GeneratorExpressionContent::Evaluate(
return std::string();
}
- return node->Evaluate(parameters, context, this, dagChecker);
+ {
+#ifndef CMAKE_BOOTSTRAP
+ auto execProfilingRAII =
+ context->LG->GetCMakeInstance()->CreateProfilingEntry(
+ "genex_exec", identifier, [&parameters]() -> Json::Value {
+ Json::Value args = Json::objectValue;
+ if (!parameters.empty()) {
+ args["genexArgs"] = Json::arrayValue;
+ for (auto const& parameter : parameters) {
+ args["genexArgs"].append(parameter);
+ }
+ }
+ return args;
+ });
+#endif
+
+ return node->Evaluate(parameters, context, this, dagChecker);
+ }
}
std::string GeneratorExpressionContent::EvaluateParameters(