MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / analyseTrack

Function analyseTrack

src/gui2/summaryview.cc:87–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85};
86
87static 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
121static void drawCylinderRule(unsigned min, unsigned max)
122{

Callers 2

drawPhysicalMapFunction · 0.85
drawLogicalMapFunction · 0.85

Calls 3

findSectorsFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected