Skip to content

Commit 3f91ea9

Browse files
authored
Fix spilling info bounds and start-finish times (#15044)
1 parent 1d92a1f commit 3f91ea9

File tree

1 file changed

+28
-37
lines changed

1 file changed

+28
-37
lines changed

ydb/public/lib/ydb_cli/common/plan2svg.cpp

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -782,23 +782,6 @@ void TPlan::LoadStage(std::shared_ptr<TStage> stage, const NJson::TJsonValue& no
782782
}
783783
}
784784
}
785-
/*
786-
if (auto* tableArrayNode = stage->StatsNode->GetValueByPath("Table")) {
787-
for (const auto& tableNode : tableArrayNode->GetArray()) {
788-
if (auto* pathNode = tableNode.GetValueByPath("Path")) {
789-
if (tablePath == pathNode->GetStringSafe()) {
790-
if (auto* bytesNode = tableNode.GetValueByPath("ReadBytes")) {
791-
stage->IngressBytes = std::make_shared<TSingleMetric>(IngressBytes, *bytesNode);
792-
}
793-
if (auto* rowsNode = tableNode.GetValueByPath("ReadRows")) {
794-
stage->IngressRows = std::make_shared<TSingleMetric>(IngressRows, *rowsNode);
795-
}
796-
break;
797-
}
798-
}
799-
}
800-
}
801-
*/
802785
}
803786
}
804787
}
@@ -867,22 +850,6 @@ void TPlan::LoadStage(std::shared_ptr<TStage> stage, const NJson::TJsonValue& no
867850
}
868851
}
869852

870-
if (auto* spillingComputeBytesNode = stage->StatsNode->GetValueByPath("SpillingComputeBytes")) {
871-
stage->SpillingComputeBytes = std::make_shared<TSingleMetric>(SpillingComputeBytes, *spillingComputeBytesNode);
872-
}
873-
874-
if (auto* spillingComputeTimeNode = stage->StatsNode->GetValueByPath("SpillingComputeTimeUs")) {
875-
stage->SpillingComputeTime = std::make_shared<TSingleMetric>(SpillingComputeTime, *spillingComputeTimeNode);
876-
}
877-
878-
if (auto* spillingChannelBytesNode = stage->StatsNode->GetValueByPath("SpillingChannelBytes")) {
879-
stage->SpillingChannelBytes = std::make_shared<TSingleMetric>(SpillingChannelBytes, *spillingChannelBytesNode);
880-
}
881-
882-
if (auto* spillingChannelTimeNode = stage->StatsNode->GetValueByPath("SpillingChannelTimeUs")) {
883-
stage->SpillingChannelTime = std::make_shared<TSingleMetric>(SpillingChannelTime, *spillingChannelTimeNode);
884-
}
885-
886853
if (auto* outputNode = stage->StatsNode->GetValueByPath("Output")) {
887854
for (const auto& subNode : outputNode->GetArray()) {
888855
if (auto* nameNode = subNode.GetValueByPath("Name")) {
@@ -911,6 +878,26 @@ void TPlan::LoadStage(std::shared_ptr<TStage> stage, const NJson::TJsonValue& no
911878
}
912879
}
913880

881+
if (auto* spillingComputeBytesNode = stage->StatsNode->GetValueByPath("SpillingComputeBytes")) {
882+
stage->SpillingComputeBytes = std::make_shared<TSingleMetric>(SpillingComputeBytes, *spillingComputeBytesNode,
883+
stage->MinTime, stage->MaxTime);
884+
}
885+
886+
if (auto* spillingComputeTimeNode = stage->StatsNode->GetValueByPath("SpillingComputeTimeUs")) {
887+
stage->SpillingComputeTime = std::make_shared<TSingleMetric>(SpillingComputeTime, *spillingComputeTimeNode,
888+
stage->MinTime, stage->MaxTime);
889+
}
890+
891+
if (auto* spillingChannelBytesNode = stage->StatsNode->GetValueByPath("SpillingChannelBytes")) {
892+
stage->SpillingChannelBytes = std::make_shared<TSingleMetric>(SpillingChannelBytes, *spillingChannelBytesNode,
893+
stage->MinTime, stage->MaxTime);
894+
}
895+
896+
if (auto* spillingChannelTimeNode = stage->StatsNode->GetValueByPath("SpillingChannelTimeUs")) {
897+
stage->SpillingChannelTime = std::make_shared<TSingleMetric>(SpillingChannelTime, *spillingChannelTimeNode,
898+
stage->MinTime, stage->MaxTime);
899+
}
900+
914901
inputNode = stage->StatsNode->GetValueByPath("Input");
915902
}
916903

@@ -1583,11 +1570,13 @@ void TPlan::PrintSvg(ui64 maxTime, ui32& offsetY, TStringBuilder& background, TS
15831570
PrintStageSummary(background, canvas, Config.SummaryLeft, Config.SummaryWidth, y0, INTERNAL_HEIGHT, s->OutputBytes, Config.Palette.OutputMedium, Config.Palette.OutputLight, textSum, tooltip, taskCount);
15841571

15851572
if (s->SpillingChannelBytes && s->SpillingChannelBytes->Details.Sum) {
1586-
auto x1 = Config.SummaryLeft + Config.SummaryWidth - INTERNAL_GAP_X;
1587-
auto x0 = x1 - textSum.size() * INTERNAL_TEXT_HEIGHT * 7 / 10;
15881573
background
15891574
<< "<g><title>";
1575+
15901576
auto textSum = FormatTooltip(background, "Channel Spilling", s->SpillingChannelBytes.get(), FormatBytes);
1577+
auto x1 = Config.SummaryLeft + Config.SummaryWidth - INTERNAL_GAP_X;
1578+
auto x0 = x1 - textSum.size() * INTERNAL_TEXT_HEIGHT * 7 / 10;
1579+
15911580
background
15921581
<< "</title>" << Endl
15931582
<< " <rect x='" << x0 << "' y='" << y0 + (INTERNAL_HEIGHT - INTERNAL_TEXT_HEIGHT) / 2
@@ -1627,11 +1616,13 @@ void TPlan::PrintSvg(ui64 maxTime, ui32& offsetY, TStringBuilder& background, TS
16271616
PrintStageSummary(background, canvas, Config.SummaryLeft, Config.SummaryWidth, y0, INTERNAL_HEIGHT, s->MaxMemoryUsage, Config.Palette.MemMedium, Config.Palette.MemLight, textSum, tooltip, taskCount);
16281617

16291618
if (s->SpillingComputeBytes && s->SpillingComputeBytes->Details.Sum) {
1630-
auto x1 = Config.SummaryLeft + Config.SummaryWidth - INTERNAL_GAP_X;
1631-
auto x0 = x1 - textSum.size() * INTERNAL_TEXT_HEIGHT * 7 / 10;
16321619
background
16331620
<< "<g><title>";
1621+
16341622
auto textSum = FormatTooltip(background, "Compute Spilling", s->SpillingComputeBytes.get(), FormatBytes);
1623+
auto x1 = Config.SummaryLeft + Config.SummaryWidth - INTERNAL_GAP_X;
1624+
auto x0 = x1 - textSum.size() * INTERNAL_TEXT_HEIGHT * 7 / 10;
1625+
16351626
background
16361627
<< "</title>" << Endl
16371628
<< "<rect x='" << x0 << "' y='" << y0 + (INTERNAL_HEIGHT - INTERNAL_TEXT_HEIGHT) / 2

0 commit comments

Comments
 (0)