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

Method ReadCostData

Source/CTest/cmCTestMultiProcessHandler.cxx:877–919  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

875}
876
877void cmCTestMultiProcessHandler::ReadCostData()
878{
879 std::string fname = this->CTest->GetCostDataFile();
880
881 if (cmSystemTools::FileExists(fname, true)) {
882 cmsys::ifstream fin;
883 fin.open(fname.c_str());
884 std::string line;
885 while (std::getline(fin, line)) {
886 if (line == "---") {
887 break;
888 }
889
890 // Format: <name> <previous_runs> <avg_cost>
891 cm::optional<CostEntry> entry = splitCostLine(line);
892
893 // Probably an older version of the file, will be fixed next run
894 if (!entry) {
895 fin.close();
896 return;
897 }
898
899 int index = this->SearchByName(entry->name);
900 if (index == -1) {
901 continue;
902 }
903
904 this->Properties[index]->PreviousRuns = entry->prevRuns;
905 // When not running in parallel mode, don't use cost data
906 if (this->GetParallelLevel() > 1 && this->Properties[index] &&
907 this->Properties[index]->Cost == 0) {
908 this->Properties[index]->Cost = entry->cost;
909 }
910 }
911 // Next part of the file is the failed tests
912 while (std::getline(fin, line)) {
913 if (!line.empty()) {
914 this->LastTestsFailed.push_back(line);
915 }
916 }
917 fin.close();
918 }
919}
920
921int cmCTestMultiProcessHandler::SearchByName(cm::string_view name)
922{

Callers 1

SetTestsMethod · 0.95

Calls 10

SearchByNameMethod · 0.95
GetParallelLevelMethod · 0.95
splitCostLineFunction · 0.85
GetCostDataFileMethod · 0.80
c_strMethod · 0.80
push_backMethod · 0.80
FileExistsFunction · 0.50
openMethod · 0.45
closeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected