| 583 | } |
| 584 | |
| 585 | std::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 | |
| 619 | void cmInstrumentation::GetPreTestStats() |
| 620 | { |