Skip to content

Commit 11920cf

Browse files
committed
YQL-20395 allocation nodes tracing
commit_hash:2d12191c96ac70782c63140c0081c786e65d5d24
1 parent 13a24ce commit 11920cf

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

yql/essentials/core/yql_graph_transformer.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <yql/essentials/ast/yql_expr.h>
33
#include <yql/essentials/utils/yql_panic.h>
44
#include <yql/essentials/public/issue/yql_issue_manager.h>
5+
#include <yql/essentials/utils/log/log.h>
56

67
namespace NYql {
78

@@ -38,6 +39,7 @@ class TSharedTransformerProxy : public IGraphTransformer {
3839
};
3940

4041
class TCompositeGraphTransformer : public TGraphTransformerBase {
42+
static constexpr ui64 MinAllocationDelta = 1000;
4143
public:
4244
TCompositeGraphTransformer(const TVector<TTransformStage>& stages, bool useIssueScopes, bool doCheckArguments)
4345
: Stages_(stages)
@@ -74,6 +76,7 @@ class TCompositeGraphTransformer : public TGraphTransformerBase {
7476
return TStatus::Ok;
7577
}
7678

79+
auto prevUniqueId = ctx.NextUniqueId;
7780
auto status = WithScope(ctx, [&]() {
7881
return Stages_[Index_].GetTransformer().Transform(input, output, ctx);
7982
});
@@ -92,6 +95,10 @@ class TCompositeGraphTransformer : public TGraphTransformerBase {
9295
Y_UNUSED(DoCheckArguments_);
9396
Y_UNUSED(CheckArgumentsCount_);
9497
#endif
98+
if (ctx.NextUniqueId >= prevUniqueId + MinAllocationDelta) {
99+
YQL_CLOG(DEBUG, Perf) << "Allocated " << (ctx.NextUniqueId - prevUniqueId) << " nodes after Transform, stage: " << Stages_[Index_].Name;
100+
}
101+
95102
status = HandleStatus(status);
96103
return status;
97104
}
@@ -103,10 +110,15 @@ class TCompositeGraphTransformer : public TGraphTransformerBase {
103110

104111
TStatus DoApplyAsyncChanges(TExprNode::TPtr input, TExprNode::TPtr& output, TExprContext& ctx) override {
105112
YQL_ENSURE(Index_ < Stages_.size());
113+
auto prevUniqueId = ctx.NextUniqueId;
106114
auto status = WithScope(ctx, [&]() {
107115
return Stages_[Index_].GetTransformer().ApplyAsyncChanges(input, output, ctx);
108116
});
109117

118+
if (ctx.NextUniqueId >= prevUniqueId + MinAllocationDelta) {
119+
YQL_CLOG(DEBUG, Perf) << "Allocated " << (ctx.NextUniqueId - prevUniqueId) << " nodes after ApplyAsyncChanges, stage: " << Stages_[Index_].Name;
120+
}
121+
110122
status = HandleStatus(status);
111123
return status;
112124
}

0 commit comments

Comments
 (0)