instrumentation: Rename install and custom trace events

Follow the format of other trace events to produce a pretty name for
install events (as the last component of the install script directory)
and a slightly prettier name for custom events (still limited by the
nature of custom targets).
This commit is contained in:
Tyler Yankee
2025-09-04 10:02:58 -04:00
parent 89f4471c4c
commit 933176c2d1
2 changed files with 25 additions and 27 deletions
+11 -7
View File
@@ -20,6 +20,7 @@
#include "cmsys/FStream.hxx"
#include "cmsys/SystemInformation.hxx"
#include "cmCMakePath.h"
#include "cmCryptoHash.h"
#include "cmExperimental.h"
#include "cmFileLock.h"
@@ -946,16 +947,19 @@ void cmInstrumentation::AppendTraceEvent(Json::Value& trace,
// Provide a useful trace event name depending on what data is available
// from the snippet.
std::string name = snippetData["role"].asString();
std::string name = cmStrCat(snippetData["role"].asString(), ": ");
if (snippetData["role"] == "compile") {
name = cmStrCat("compile: ", snippetData["source"].asString());
name.append(snippetData["source"].asString());
} else if (snippetData["role"] == "link") {
name = cmStrCat("link: ", snippetData["target"].asString());
} else if (snippetData["role"] == "custom" ||
snippetData["role"] == "install") {
name = snippetData["command"].asString();
name.append(snippetData["target"].asString());
} else if (snippetData["role"] == "install") {
cmCMakePath workingDir(snippetData["workingDir"].asCString());
std::string lastDirName = workingDir.GetFileName().String();
name.append(lastDirName);
} else if (snippetData["role"] == "custom") {
name.append(snippetData["command"].asString());
} else if (snippetData["role"] == "test") {
name = cmStrCat("test: ", snippetData["testName"].asString());
name.append(snippetData["testName"].asString());
}
snippetTraceEvent["name"] = name;