| 112 | } |
| 113 | |
| 114 | void drawProfilerTreeView(float uiScale) { |
| 115 | (void)uiScale; |
| 116 | |
| 117 | const Profiler& profiler = Profiler::instance(); |
| 118 | const std::vector<ProfileTreeEntry>& treeEntries = profiler.treeEntries(); |
| 119 | |
| 120 | std::vector<size_t> rootIndices; |
| 121 | rootIndices.reserve(treeEntries.size()); |
| 122 | double accountedPercent = 0.0; |
| 123 | for (size_t i = 0; i < treeEntries.size(); ++i) { |
| 124 | const ProfileTreeEntry& entry = treeEntries[i]; |
| 125 | if (entry.parentIndex == ProfileTreeEntry::kNoParent && isVisibleNode(entry)) { |
| 126 | rootIndices.emplace_back(i); |
| 127 | accountedPercent += entry.smoothedPercentOfFrame; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | std::sort(rootIndices.begin(), rootIndices.end(), |
| 132 | [&](size_t lhs, size_t rhs) { return treeEntries[lhs].smoothedMs > treeEntries[rhs].smoothedMs; }); |
| 133 | |
| 134 | accountedPercent = std::clamp(accountedPercent, 0.0, 100.0); |
| 135 | double totalTrackedMs = 0.0; |
| 136 | for (const size_t rootIndex : rootIndices) { |
| 137 | totalTrackedMs += treeEntries[rootIndex].smoothedMs; |
| 138 | } |
| 139 | |
| 140 | ImGui::TextDisabled("Загрузка CPU"); |
| 141 | ImGui::SameLine(); |
| 142 | ImGui::Text("%.1f%%", accountedPercent); |
| 143 | ImGui::ProgressBar(static_cast<float>(accountedPercent / 100.0), ImVec2(-1.0f, 0.0f)); |
| 144 | ImGui::Separator(); |
| 145 | |
| 146 | for (const size_t rootIndex : rootIndices) { |
| 147 | drawTreeNode(treeEntries, rootIndex, totalTrackedMs); |
| 148 | } |
| 149 | } |
nothing calls this directly
no test coverage detected