| 85 | }; |
| 86 | |
| 87 | static TrackAnalysis analyseTrack( |
| 88 | const Disk& disk, unsigned physicalCylinder, unsigned physicalHead) |
| 89 | { |
| 90 | TrackAnalysis result = {}; |
| 91 | auto sectors = findSectors(disk, physicalCylinder, physicalHead); |
| 92 | result.colour = ImGui::GetColorU32(ImGuiCol_TextDisabled); |
| 93 | result.tooltip = "No data"; |
| 94 | if (!sectors.empty()) |
| 95 | { |
| 96 | unsigned totalSectors = sectors.size(); |
| 97 | unsigned goodSectors = std::ranges::count_if(sectors, |
| 98 | [](auto& e) |
| 99 | { |
| 100 | return e->status == Sector::OK; |
| 101 | }); |
| 102 | unsigned badSectors = totalSectors - goodSectors; |
| 103 | |
| 104 | result.colour = ImGuiExt::GetCustomColorU32( |
| 105 | ((goodSectors == totalSectors) && goodSectors && totalSectors) |
| 106 | ? ImGuiCustomCol_LoggerInfo |
| 107 | : ImGuiCustomCol_LoggerError); |
| 108 | |
| 109 | result.tooltip = fmt::format( |
| 110 | "c{}h{}\n{} sectors read\n{} good " |
| 111 | "sectors\n{} bad sectors", |
| 112 | physicalCylinder, |
| 113 | physicalHead, |
| 114 | totalSectors, |
| 115 | goodSectors, |
| 116 | badSectors); |
| 117 | } |
| 118 | return result; |
| 119 | } |
| 120 | |
| 121 | static void drawCylinderRule(unsigned min, unsigned max) |
| 122 | { |
no test coverage detected