19 void Cell(std::string_view text) {
20 ImGui::TableNextColumn();
21 ImGui::TextUnformatted(text.data(), text.data() + text.size());
24 double PerTick(uint64_t count, uint64_t ticks) {
25 return ticks > 0 ?
static_cast<double>(count) /
static_cast<double>(ticks) : 0.0;
34 if (!ImGui::BeginTable(
"units", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit))
37 ImGui::TableSetupColumn(
"単位");
38 ImGui::TableSetupColumn(
"ms/刻み");
39 ImGui::TableSetupColumn(
"割合");
40 ImGui::TableHeadersRow();
44 ImGui::TableNextColumn();
45 const float fraction = total > 0.0 ?
static_cast<float>(unit.
millisecondsPerTick / total) : 0.0f;
46 ImGui::ProgressBar(fraction, {120.0f, 0.0f});
50 ImGui::TextUnformatted(std::format(
"合計 {:.3f} ms/刻み", total).c_str());
55 const ImGuiTableFlags flags = ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit;
56 if (!ImGui::BeginTable(
"nodes", 6, flags))
59 ImGui::TableSetupColumn(
"ノード");
60 ImGui::TableSetupColumn(
"起動/刻み");
61 ImGui::TableSetupColumn(
"入力/刻み");
62 ImGui::TableSetupColumn(
"出力/刻み");
63 ImGui::TableSetupColumn(
"1 回の出力 最大/上限");
64 ImGui::TableSetupColumn(
"再帰 最大/上限");
65 ImGui::TableHeadersRow();
66 const size_t count = std::min(layout.
nodes.size(), status.
stats.
nodes.size());
67 for (
size_t index = 0; index < count; ++index) {
88 for (
size_t index = 0; index < count; ++index) {
91 const float fraction = gauge.
capacity > 0
92 ?
static_cast<float>(peak) /
static_cast<float>(gauge.
capacity)
94 ImGui::ProgressBar(std::min(fraction, 1.0f), {160.0f, 0.0f},
95 std::format(
"{} / {}", peak, gauge.
capacity).c_str());
97 ImGui::TextUnformatted(gauge.
name.c_str());
104 if (findings.empty()) {
105 ImGui::TextUnformatted(
"上限: 余裕あり");
110 ImGui::TextColored(
WARNING_COLOR,
"%s", finding.text.c_str());
116 ImGui::SetNextWindowPos({PANEL_X_PIXELS, PANEL_Y_PIXELS}, ImGuiCond_FirstUseEver);
117 ImGui::Begin(
"Work Graphs と性能",
nullptr, ImGuiWindowFlags_AlwaysAutoResize);
118 ImGui::TextUnformatted(std::format(
"直近 1 秒: {} 刻み", status.
ticks).c_str());
120 ImGui::SeparatorText(
"刻みの単位の GPU 時間");
121 BuildUnitTable(status);
124 ImGui::SeparatorText(std::format(
"{} のノード", status.
layout->
name).c_str());
125 BuildNodeTable(*status.
layout, status);
126 BuildGauges(*status.
layout, status);
127 BuildFindings(*status.
layout, status);
130 ImGui::TextDisabled(
"ノードごとの時間は測れない(タイムスタンプは DispatchGraph の前後だけ)");
constexpr float PANEL_X_PIXELS
constexpr float PANEL_Y_PIXELS
constexpr ImVec4 WARNING_COLOR
void BuildGauges(const gpu::GraphStatsLayout &layout, const GraphPanelStatus &status)
void BuildUnitTable(const GraphPanelStatus &status)
void BuildNodeTable(const gpu::GraphStatsLayout &layout, const GraphPanelStatus &status)
double PerTick(uint64_t count, uint64_t ticks)
void Cell(std::string_view text)
void BuildFindings(const gpu::GraphStatsLayout &layout, const GraphPanelStatus &status)
void BuildGraphPanel(const GraphPanelStatus &status)
std::vector< GraphFinding > EvaluateGraphStats(const GraphStatsLayout &layout, const GraphStatsSnapshot &snapshot)
const gpu::GraphStatsLayout * layout
std::vector< UnitTime > units
gpu::GraphStatsSnapshot stats
double millisecondsPerTick
uint32_t deepestRecursion
uint32_t peakRequestedOutputs
uint32_t maxRecursionDepth
uint32_t maxOutputRecords
std::vector< GraphNodeLimits > nodes
std::vector< GraphGaugeLimits > gauges
std::vector< uint32_t > gaugePeaks
std::vector< GraphNodeCounters > nodes