File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -483,6 +483,9 @@ ConstraintSystem::SolverScope::SolverScope(ConstraintSystem &cs)
483
483
numDefaultedConstraints = cs.DefaultedConstraints .size ();
484
484
numCheckedConformances = cs.CheckedConformances .size ();
485
485
PreviousScore = cs.CurrentScore ;
486
+ if (cs.Timer ) {
487
+ startTime = cs.Timer ->getElapsedProcessTimeInFractionalSeconds ();
488
+ }
486
489
487
490
cs.solverState ->registerScope (this );
488
491
assert (!cs.failedConstraint && " Unexpected failed constraint!" );
Original file line number Diff line number Diff line change @@ -1445,6 +1445,9 @@ class ConstraintSystem {
1445
1445
// / The previous score.
1446
1446
Score PreviousScore;
1447
1447
1448
+ // / Time in fractional seconds at which we entered this scope.
1449
+ double startTime;
1450
+
1448
1451
// / Constraint graph scope associated with this solver scope.
1449
1452
ConstraintGraphScope CGScope;
1450
1453
@@ -1456,6 +1459,13 @@ class ConstraintSystem {
1456
1459
public:
1457
1460
explicit SolverScope (ConstraintSystem &cs);
1458
1461
~SolverScope ();
1462
+
1463
+ Optional<double > getElapsedTimeInFractionalSeconds () {
1464
+ if (!cs.Timer )
1465
+ return None;
1466
+
1467
+ return cs.Timer ->getElapsedProcessTimeInFractionalSeconds () - startTime;
1468
+ }
1459
1469
};
1460
1470
1461
1471
ConstraintSystem (TypeChecker &tc, DeclContext *dc,
You can’t perform that action at this time.
0 commit comments