MCPcopy Create free account
hub / github.com/Kitware/CMake / InstrumentTest

Method InstrumentTest

Source/cmInstrumentation.cxx:585–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

583}
584
585std::string cmInstrumentation::InstrumentTest(
586 std::string const& name, std::string const& command,
587 std::vector<std::string> const& args, int64_t result,
588 std::chrono::steady_clock::time_point steadyStart,
589 std::chrono::system_clock::time_point systemStart, std::string config)
590{
591 // Store command info
592 Json::Value root(this->preTestStats);
593 std::string command_str = cmStrCat(command, ' ', GetCommandStr(args));
594 root["command"] = command_str;
595 root["role"] = "test";
596 root["testName"] = name;
597 root["result"] = static_cast<Json::Value::Int64>(result);
598 root["config"] = config;
599 root["workingDir"] = cmSystemTools::GetLogicalWorkingDirectory();
600
601 // Post-Command
602 this->InsertTimingData(root, steadyStart, systemStart);
603 if (this->HasOption(
604 cmInstrumentationQuery::Option::DynamicSystemInformation)) {
605 this->InsertDynamicSystemInformation(root, "after");
606 }
607
608 cmsys::SystemInformation& info = this->GetSystemInformation();
609 std::chrono::system_clock::time_point endTime =
610 systemStart + std::chrono::milliseconds(root["duration"].asUInt64());
611 std::string file_name = cmStrCat(
612 "test-",
613 this->ComputeSuffixHash(cmStrCat(command_str, info.GetProcessId())), '-',
614 this->ComputeSuffixTime(endTime), ".json");
615 this->WriteInstrumentationJson(latestDataVersion, root, "data", file_name);
616 return file_name;
617}
618
619void cmInstrumentation::GetPreTestStats()
620{

Callers 1

FinalizeTestMethod · 0.80

Calls 10

InsertTimingDataMethod · 0.95
HasOptionMethod · 0.95
ComputeSuffixHashMethod · 0.95
ComputeSuffixTimeMethod · 0.95
GetSystemInformationMethod · 0.80
asUInt64Method · 0.80
GetProcessIdMethod · 0.80
cmStrCatFunction · 0.70

Tested by 1

FinalizeTestMethod · 0.64