Skip to content

Commit ada6f77

Browse files
committed
Sema: Track solver arena size in statistics
1 parent a7a19a0 commit ada6f77

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

include/swift/Sema/ConstraintSolverStats.def

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# error #define CS_STATISTIC(Name, Description) before including
1919
#endif
2020

21+
CS_STATISTIC(ASTBytesAllocated, "bytes allocated in solver arena")
2122
CS_STATISTIC(NumTypeVariablesBound, "# of type variables bound")
2223
CS_STATISTIC(NumTypeVariableBindings, "# of type variable bindings attempted")
2324
CS_STATISTIC(NumDisjunctions, "# of disjunctions explored")

lib/Sema/CSSolver.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,10 @@ ConstraintSystem::SolverState::~SolverState() {
669669
CS.Options -= ConstraintSystemFlags::DebugConstraints;
670670
}
671671

672+
// This statistic is special because it's not a counter; we just update
673+
// it in one shot at the end.
674+
ASTBytesAllocated = CS.getASTContext().getSolverMemory();
675+
672676
// Write our local statistics back to the overall statistics.
673677
#define CS_STATISTIC(Name, Description) JOIN2(Overall,Name) += Name;
674678
#include "swift/Sema/ConstraintSolverStats.def"

0 commit comments

Comments
 (0)