|
@@ -70,8 +70,8 @@ void cmInstrumentation::LoadQueries()
|
|
|
.Uuid;
|
|
|
if (envVal == uuid) {
|
|
|
this->AddHook(cmInstrumentationQuery::Hook::PrepareForCDash);
|
|
|
- this->AddQuery(
|
|
|
- cmInstrumentationQuery::Query::DynamicSystemInformation);
|
|
|
+ this->AddOption(
|
|
|
+ cmInstrumentationQuery::Option::DynamicSystemInformation);
|
|
|
this->cdashDir = cmStrCat(this->timingDirv1, "/cdash");
|
|
|
cmSystemTools::MakeDirectory(this->cdashDir);
|
|
|
cmSystemTools::MakeDirectory(cmStrCat(this->cdashDir, "/configure"));
|
|
@@ -159,7 +159,7 @@ bool cmInstrumentation::ReadJSONQueries(std::string const& directory)
|
|
|
void cmInstrumentation::ReadJSONQuery(std::string const& file)
|
|
|
{
|
|
|
auto query = cmInstrumentationQuery();
|
|
|
- query.ReadJSON(file, this->errorMsg, this->queries, this->hooks,
|
|
|
+ query.ReadJSON(file, this->errorMsg, this->options, this->hooks,
|
|
|
this->callbacks);
|
|
|
if (!this->errorMsg.empty()) {
|
|
|
cmSystemTools::Error(cmStrCat(
|
|
@@ -174,15 +174,15 @@ bool cmInstrumentation::HasErrors() const
|
|
|
}
|
|
|
|
|
|
void cmInstrumentation::WriteJSONQuery(
|
|
|
- std::set<cmInstrumentationQuery::Query> const& queries_,
|
|
|
+ std::set<cmInstrumentationQuery::Option> const& options_,
|
|
|
std::set<cmInstrumentationQuery::Hook> const& hooks_,
|
|
|
std::vector<std::vector<std::string>> const& callbacks_)
|
|
|
{
|
|
|
Json::Value root;
|
|
|
root["version"] = 1;
|
|
|
- root["queries"] = Json::arrayValue;
|
|
|
- for (auto const& query : queries_) {
|
|
|
- root["queries"].append(cmInstrumentationQuery::QueryString[query]);
|
|
|
+ root["options"] = Json::arrayValue;
|
|
|
+ for (auto const& option : options_) {
|
|
|
+ root["options"].append(cmInstrumentationQuery::OptionString[option]);
|
|
|
}
|
|
|
root["hooks"] = Json::arrayValue;
|
|
|
for (auto const& hook : hooks_) {
|
|
@@ -214,9 +214,9 @@ bool cmInstrumentation::HasQuery() const
|
|
|
return this->hasQuery;
|
|
|
}
|
|
|
|
|
|
-bool cmInstrumentation::HasQuery(cmInstrumentationQuery::Query query) const
|
|
|
+bool cmInstrumentation::HasOption(cmInstrumentationQuery::Option option) const
|
|
|
{
|
|
|
- return (this->queries.find(query) != this->queries.end());
|
|
|
+ return (this->options.find(option) != this->options.end());
|
|
|
}
|
|
|
|
|
|
bool cmInstrumentation::HasHook(cmInstrumentationQuery::Hook hook) const
|
|
@@ -281,7 +281,8 @@ int cmInstrumentation::CollectTimingData(cmInstrumentationQuery::Hook hook)
|
|
|
index["dataDir"] = directory;
|
|
|
index["buildDir"] = this->binaryDir;
|
|
|
index["version"] = 1;
|
|
|
- if (this->HasQuery(cmInstrumentationQuery::Query::StaticSystemInformation)) {
|
|
|
+ if (this->HasOption(
|
|
|
+ cmInstrumentationQuery::Option::StaticSystemInformation)) {
|
|
|
this->InsertStaticSystemInformation(index);
|
|
|
}
|
|
|
for (auto const& file : files) {
|
|
@@ -427,8 +428,8 @@ std::string cmInstrumentation::InstrumentTest(
|
|
|
|
|
|
// Post-Command
|
|
|
this->InsertTimingData(root, steadyStart, systemStart);
|
|
|
- if (this->HasQuery(
|
|
|
- cmInstrumentationQuery::Query::DynamicSystemInformation)) {
|
|
|
+ if (this->HasOption(
|
|
|
+ cmInstrumentationQuery::Option::DynamicSystemInformation)) {
|
|
|
this->InsertDynamicSystemInformation(root, "after");
|
|
|
}
|
|
|
|
|
@@ -443,8 +444,8 @@ std::string cmInstrumentation::InstrumentTest(
|
|
|
|
|
|
void cmInstrumentation::GetPreTestStats()
|
|
|
{
|
|
|
- if (this->HasQuery(
|
|
|
- cmInstrumentationQuery::Query::DynamicSystemInformation)) {
|
|
|
+ if (this->HasOption(
|
|
|
+ cmInstrumentationQuery::Option::DynamicSystemInformation)) {
|
|
|
this->InsertDynamicSystemInformation(this->preTestStats, "before");
|
|
|
}
|
|
|
}
|
|
@@ -452,8 +453,8 @@ void cmInstrumentation::GetPreTestStats()
|
|
|
int cmInstrumentation::InstrumentCommand(
|
|
|
std::string command_type, std::vector<std::string> const& command,
|
|
|
std::function<int()> const& callback,
|
|
|
- cm::optional<std::map<std::string, std::string>> options,
|
|
|
- cm::optional<std::map<std::string, std::string>> arrayOptions,
|
|
|
+ cm::optional<std::map<std::string, std::string>> data,
|
|
|
+ cm::optional<std::map<std::string, std::string>> arrayData,
|
|
|
LoadQueriesAfter reloadQueriesAfterCommand)
|
|
|
{
|
|
|
|
|
@@ -478,8 +479,8 @@ int cmInstrumentation::InstrumentCommand(
|
|
|
auto system_start = std::chrono::system_clock::now();
|
|
|
double preConfigureMemory = 0;
|
|
|
double preConfigureLoad = 0;
|
|
|
- if (this->HasQuery(
|
|
|
- cmInstrumentationQuery::Query::DynamicSystemInformation)) {
|
|
|
+ if (this->HasOption(
|
|
|
+ cmInstrumentationQuery::Option::DynamicSystemInformation)) {
|
|
|
this->InsertDynamicSystemInformation(root, "before");
|
|
|
} else if (reloadQueriesAfterCommand == LoadQueriesAfter::Yes) {
|
|
|
this->GetDynamicSystemInformation(preConfigureMemory, preConfigureLoad);
|
|
@@ -495,8 +496,8 @@ int cmInstrumentation::InstrumentCommand(
|
|
|
if (!this->HasQuery()) {
|
|
|
return ret;
|
|
|
}
|
|
|
- if (this->HasQuery(
|
|
|
- cmInstrumentationQuery::Query::DynamicSystemInformation)) {
|
|
|
+ if (this->HasOption(
|
|
|
+ cmInstrumentationQuery::Option::DynamicSystemInformation)) {
|
|
|
root["dynamicSystemInformation"] = Json::objectValue;
|
|
|
root["dynamicSystemInformation"]["beforeHostMemoryUsed"] =
|
|
|
preConfigureMemory;
|
|
@@ -507,14 +508,14 @@ int cmInstrumentation::InstrumentCommand(
|
|
|
|
|
|
// Post-Command
|
|
|
this->InsertTimingData(root, steady_start, system_start);
|
|
|
- if (this->HasQuery(
|
|
|
- cmInstrumentationQuery::Query::DynamicSystemInformation)) {
|
|
|
+ if (this->HasOption(
|
|
|
+ cmInstrumentationQuery::Option::DynamicSystemInformation)) {
|
|
|
this->InsertDynamicSystemInformation(root, "after");
|
|
|
}
|
|
|
|
|
|
// Gather additional data
|
|
|
- if (options.has_value()) {
|
|
|
- for (auto const& item : options.value()) {
|
|
|
+ if (data.has_value()) {
|
|
|
+ for (auto const& item : data.value()) {
|
|
|
if (item.first == "role" && !item.second.empty()) {
|
|
|
command_type = item.second;
|
|
|
} else if (!item.second.empty()) {
|
|
@@ -529,8 +530,8 @@ int cmInstrumentation::InstrumentCommand(
|
|
|
root["config"] = "";
|
|
|
}
|
|
|
|
|
|
- if (arrayOptions.has_value()) {
|
|
|
- for (auto const& item : arrayOptions.value()) {
|
|
|
+ if (arrayData.has_value()) {
|
|
|
+ for (auto const& item : arrayData.value()) {
|
|
|
if (item.first == "targetLabels" && command_type != "link") {
|
|
|
continue;
|
|
|
}
|
|
@@ -659,9 +660,9 @@ void cmInstrumentation::AddHook(cmInstrumentationQuery::Hook hook)
|
|
|
this->hooks.insert(hook);
|
|
|
}
|
|
|
|
|
|
-void cmInstrumentation::AddQuery(cmInstrumentationQuery::Query query)
|
|
|
+void cmInstrumentation::AddOption(cmInstrumentationQuery::Option option)
|
|
|
{
|
|
|
- this->queries.insert(query);
|
|
|
+ this->options.insert(option);
|
|
|
}
|
|
|
|
|
|
std::string const& cmInstrumentation::GetCDashDir()
|