diff options
author | Gereon Kremer <nafur42@gmail.com> | 2021-09-11 21:13:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-11 19:13:34 +0000 |
commit | 2384a8d85517e00bc94e7fcf759a75dc6ea9b009 (patch) | |
tree | e4d8084d774b7ad334c0c2b91a7d985d876a990e /src/theory/arith | |
parent | b85e8a3d3f66ca844dc9b4790cd549a8dd0739a7 (diff) |
Use StatisticsRegistry from Env (#7166)
This commit better integrates the StatisticsRegistry with the environment. It makes the registry an `EnvObj` itself and adds a getter to `EnvObj` to get the registry. It also refactors parts of cvc5 to use this new mechanism to obtain the registry instead of using the (global, static) `smtStatisticsRegistry()` function.
Diffstat (limited to 'src/theory/arith')
-rw-r--r-- | src/theory/arith/theory_arith.cpp | 4 | ||||
-rw-r--r-- | src/theory/arith/theory_arith_private.cpp | 250 | ||||
-rw-r--r-- | src/theory/arith/theory_arith_private.h | 2 |
3 files changed, 110 insertions, 146 deletions
diff --git a/src/theory/arith/theory_arith.cpp b/src/theory/arith/theory_arith.cpp index 9642bf394..03fb06a96 100644 --- a/src/theory/arith/theory_arith.cpp +++ b/src/theory/arith/theory_arith.cpp @@ -37,8 +37,8 @@ namespace arith { TheoryArith::TheoryArith(Env& env, OutputChannel& out, Valuation valuation) : Theory(THEORY_ARITH, env, out, valuation), - d_ppRewriteTimer(smtStatisticsRegistry().registerTimer( - "theory::arith::ppRewriteTimer")), + d_ppRewriteTimer( + statisticsRegistry().registerTimer("theory::arith::ppRewriteTimer")), d_astate(env, valuation), d_im(env, *this, d_astate, d_pnm), d_ppre(context(), d_pnm), diff --git a/src/theory/arith/theory_arith_private.cpp b/src/theory/arith/theory_arith_private.cpp index 4efc4136a..e43f86743 100644 --- a/src/theory/arith/theory_arith_private.cpp +++ b/src/theory/arith/theory_arith_private.cpp @@ -171,7 +171,7 @@ TheoryArithPrivate::TheoryArithPrivate(TheoryArith& containing, d_solveIntAttempts(0u), d_newFacts(false), d_previousStatus(Result::SAT_UNKNOWN), - d_statistics("theory::arith::") + d_statistics(statisticsRegistry(), "theory::arith::") { } @@ -260,153 +260,117 @@ TheoryArithPrivate::ModelException::ModelException(TNode n, const char* msg) } TheoryArithPrivate::ModelException::~ModelException() {} -TheoryArithPrivate::Statistics::Statistics(const std::string& name) +TheoryArithPrivate::Statistics::Statistics(StatisticsRegistry& reg, + const std::string& name) : d_statAssertUpperConflicts( - smtStatisticsRegistry().registerInt(name + "AssertUpperConflicts")), + reg.registerInt(name + "AssertUpperConflicts")), d_statAssertLowerConflicts( - smtStatisticsRegistry().registerInt(name + "AssertLowerConflicts")), - d_statUserVariables( - smtStatisticsRegistry().registerInt(name + "UserVariables")), - d_statAuxiliaryVariables( - smtStatisticsRegistry().registerInt(name + "AuxiliaryVariables")), - d_statDisequalitySplits( - smtStatisticsRegistry().registerInt(name + "DisequalitySplits")), + reg.registerInt(name + "AssertLowerConflicts")), + d_statUserVariables(reg.registerInt(name + "UserVariables")), + d_statAuxiliaryVariables(reg.registerInt(name + "AuxiliaryVariables")), + d_statDisequalitySplits(reg.registerInt(name + "DisequalitySplits")), d_statDisequalityConflicts( - smtStatisticsRegistry().registerInt(name + "DisequalityConflicts")), - d_simplifyTimer( - smtStatisticsRegistry().registerTimer(name + "simplifyTimer")), - d_staticLearningTimer( - smtStatisticsRegistry().registerTimer(name + "staticLearningTimer")), - d_presolveTime( - smtStatisticsRegistry().registerTimer(name + "presolveTime")), - d_newPropTime( - smtStatisticsRegistry().registerTimer(name + "newPropTimer")), - d_externalBranchAndBounds(smtStatisticsRegistry().registerInt( - name + "externalBranchAndBounds")), - d_initialTableauSize( - smtStatisticsRegistry().registerInt(name + "initialTableauSize")), - d_currSetToSmaller( - smtStatisticsRegistry().registerInt(name + "currSetToSmaller")), - d_smallerSetToCurr( - smtStatisticsRegistry().registerInt(name + "smallerSetToCurr")), - d_restartTimer( - smtStatisticsRegistry().registerTimer(name + "restartTimer")), - d_boundComputationTime( - smtStatisticsRegistry().registerTimer(name + "bound::time")), - d_boundComputations(smtStatisticsRegistry().registerInt( - name + "bound::boundComputations")), - d_boundPropagations(smtStatisticsRegistry().registerInt( - name + "bound::boundPropagations")), - d_unknownChecks( - smtStatisticsRegistry().registerInt(name + "status::unknowns")), - d_maxUnknownsInARow(smtStatisticsRegistry().registerInt( - name + "status::maxUnknownsInARow")), - d_avgUnknownsInARow(smtStatisticsRegistry().registerAverage( - name + "status::avgUnknownsInARow")), - d_revertsOnConflicts(smtStatisticsRegistry().registerInt( - name + "status::revertsOnConflicts")), - d_commitsOnConflicts(smtStatisticsRegistry().registerInt( - name + "status::commitsOnConflicts")), - d_nontrivialSatChecks(smtStatisticsRegistry().registerInt( - name + "status::nontrivialSatChecks")), - d_replayLogRecCount( - smtStatisticsRegistry().registerInt(name + "z::approx::replay::rec")), - d_replayLogRecConflictEscalation(smtStatisticsRegistry().registerInt( - name + "z::approx::replay::rec::escalation")), - d_replayLogRecEarlyExit(smtStatisticsRegistry().registerInt( - name + "z::approx::replay::rec::earlyexit")), - d_replayBranchCloseFailures(smtStatisticsRegistry().registerInt( + reg.registerInt(name + "DisequalityConflicts")), + d_simplifyTimer(reg.registerTimer(name + "simplifyTimer")), + d_staticLearningTimer(reg.registerTimer(name + "staticLearningTimer")), + d_presolveTime(reg.registerTimer(name + "presolveTime")), + d_newPropTime(reg.registerTimer(name + "newPropTimer")), + d_externalBranchAndBounds( + reg.registerInt(name + "externalBranchAndBounds")), + d_initialTableauSize(reg.registerInt(name + "initialTableauSize")), + d_currSetToSmaller(reg.registerInt(name + "currSetToSmaller")), + d_smallerSetToCurr(reg.registerInt(name + "smallerSetToCurr")), + d_restartTimer(reg.registerTimer(name + "restartTimer")), + d_boundComputationTime(reg.registerTimer(name + "bound::time")), + d_boundComputations(reg.registerInt(name + "bound::boundComputations")), + d_boundPropagations(reg.registerInt(name + "bound::boundPropagations")), + d_unknownChecks(reg.registerInt(name + "status::unknowns")), + d_maxUnknownsInARow(reg.registerInt(name + "status::maxUnknownsInARow")), + d_avgUnknownsInARow( + reg.registerAverage(name + "status::avgUnknownsInARow")), + d_revertsOnConflicts( + reg.registerInt(name + "status::revertsOnConflicts")), + d_commitsOnConflicts( + reg.registerInt(name + "status::commitsOnConflicts")), + d_nontrivialSatChecks( + reg.registerInt(name + "status::nontrivialSatChecks")), + d_replayLogRecCount(reg.registerInt(name + "z::approx::replay::rec")), + d_replayLogRecConflictEscalation( + reg.registerInt(name + "z::approx::replay::rec::escalation")), + d_replayLogRecEarlyExit( + reg.registerInt(name + "z::approx::replay::rec::earlyexit")), + d_replayBranchCloseFailures(reg.registerInt( name + "z::approx::replay::rec::branch::closefailures")), - d_replayLeafCloseFailures(smtStatisticsRegistry().registerInt( + d_replayLeafCloseFailures(reg.registerInt( name + "z::approx::replay::rec::leaf::closefailures")), - d_replayBranchSkips(smtStatisticsRegistry().registerInt( - name + "z::approx::replay::rec::branch::skips")), - d_mirCutsAttempted(smtStatisticsRegistry().registerInt( - name + "z::approx::cuts::mir::attempted")), - d_gmiCutsAttempted(smtStatisticsRegistry().registerInt( - name + "z::approx::cuts::gmi::attempted")), - d_branchCutsAttempted(smtStatisticsRegistry().registerInt( - name + "z::approx::cuts::branch::attempted")), - d_cutsReconstructed(smtStatisticsRegistry().registerInt( - name + "z::approx::cuts::reconstructed")), - d_cutsReconstructionFailed(smtStatisticsRegistry().registerInt( - name + "z::approx::cuts::reconstructed::failed")), - d_cutsProven(smtStatisticsRegistry().registerInt( - name + "z::approx::cuts::proofs")), - d_cutsProofFailed(smtStatisticsRegistry().registerInt( - name + "z::approx::cuts::proofs::failed")), - d_mipReplayLemmaCalls(smtStatisticsRegistry().registerInt( - name + "z::approx::external::calls")), - d_mipExternalCuts(smtStatisticsRegistry().registerInt( - name + "z::approx::external::cuts")), - d_mipExternalBranch(smtStatisticsRegistry().registerInt( - name + "z::approx::external::branches")), - d_inSolveInteger(smtStatisticsRegistry().registerInt( - name + "z::approx::inSolverInteger")), - d_branchesExhausted(smtStatisticsRegistry().registerInt( - name + "z::approx::exhausted::branches")), - d_execExhausted(smtStatisticsRegistry().registerInt( - name + "z::approx::exhausted::exec")), - d_pivotsExhausted(smtStatisticsRegistry().registerInt( - name + "z::approx::exhausted::pivots")), - d_panicBranches( - smtStatisticsRegistry().registerInt(name + "z::arith::paniclemmas")), - d_relaxCalls( - smtStatisticsRegistry().registerInt(name + "z::arith::relax::calls")), - d_relaxLinFeas(smtStatisticsRegistry().registerInt( - name + "z::arith::relax::feasible::res")), - d_relaxLinFeasFailures(smtStatisticsRegistry().registerInt( - name + "z::arith::relax::feasible::failures")), - d_relaxLinInfeas(smtStatisticsRegistry().registerInt( - name + "z::arith::relax::infeasible")), - d_relaxLinInfeasFailures(smtStatisticsRegistry().registerInt( - name + "z::arith::relax::infeasible::failures")), - d_relaxLinExhausted(smtStatisticsRegistry().registerInt( - name + "z::arith::relax::exhausted")), - d_relaxOthers( - smtStatisticsRegistry().registerInt(name + "z::arith::relax::other")), - d_applyRowsDeleted(smtStatisticsRegistry().registerInt( - name + "z::arith::cuts::applyRowsDeleted")), - d_replaySimplexTimer(smtStatisticsRegistry().registerTimer( - name + "z::approx::replay::simplex::timer")), - d_replayLogTimer(smtStatisticsRegistry().registerTimer( - name + "z::approx::replay::log::timer")), - d_solveIntTimer( - smtStatisticsRegistry().registerTimer(name + "z::solveInt::timer")), - d_solveRealRelaxTimer(smtStatisticsRegistry().registerTimer( - name + "z::solveRealRelax::timer")), - d_solveIntCalls( - smtStatisticsRegistry().registerInt(name + "z::solveInt::calls")), - d_solveStandardEffort(smtStatisticsRegistry().registerInt( - name + "z::solveInt::calls::standardEffort")), - d_approxDisabled( - smtStatisticsRegistry().registerInt(name + "z::approxDisabled")), - d_replayAttemptFailed( - smtStatisticsRegistry().registerInt(name + "z::replayAttemptFailed")), - d_cutsRejectedDuringReplay(smtStatisticsRegistry().registerInt( - name + "z::approx::replay::cuts::rejected")), - d_cutsRejectedDuringLemmas(smtStatisticsRegistry().registerInt( - name + "z::approx::external::cuts::rejected")), - d_satPivots(smtStatisticsRegistry().registerHistogram<uint32_t>( - name + "pivots::sat")), - d_unsatPivots(smtStatisticsRegistry().registerHistogram<uint32_t>( - name + "pivots::unsat")), - d_unknownPivots(smtStatisticsRegistry().registerHistogram<uint32_t>( - name + "pivots::unknown")), - d_solveIntModelsAttempts(smtStatisticsRegistry().registerInt( - name + "z::solveInt::models::attempts")), - d_solveIntModelsSuccessful(smtStatisticsRegistry().registerInt( - name + "zzz::solveInt::models::successful")), - d_mipTimer(smtStatisticsRegistry().registerTimer( - name + "z::approx::mip::timer")), - d_lpTimer( - smtStatisticsRegistry().registerTimer(name + "z::approx::lp::timer")), - d_mipProofsAttempted(smtStatisticsRegistry().registerInt( - name + "z::mip::proofs::attempted")), - d_mipProofsSuccessful(smtStatisticsRegistry().registerInt( - name + "z::mip::proofs::successful")), - d_numBranchesFailed(smtStatisticsRegistry().registerInt( - name + "z::mip::branch::proof::failed")) + d_replayBranchSkips( + reg.registerInt(name + "z::approx::replay::rec::branch::skips")), + d_mirCutsAttempted( + reg.registerInt(name + "z::approx::cuts::mir::attempted")), + d_gmiCutsAttempted( + reg.registerInt(name + "z::approx::cuts::gmi::attempted")), + d_branchCutsAttempted( + reg.registerInt(name + "z::approx::cuts::branch::attempted")), + d_cutsReconstructed( + reg.registerInt(name + "z::approx::cuts::reconstructed")), + d_cutsReconstructionFailed( + reg.registerInt(name + "z::approx::cuts::reconstructed::failed")), + d_cutsProven(reg.registerInt(name + "z::approx::cuts::proofs")), + d_cutsProofFailed( + reg.registerInt(name + "z::approx::cuts::proofs::failed")), + d_mipReplayLemmaCalls( + reg.registerInt(name + "z::approx::external::calls")), + d_mipExternalCuts(reg.registerInt(name + "z::approx::external::cuts")), + d_mipExternalBranch( + reg.registerInt(name + "z::approx::external::branches")), + d_inSolveInteger(reg.registerInt(name + "z::approx::inSolverInteger")), + d_branchesExhausted( + reg.registerInt(name + "z::approx::exhausted::branches")), + d_execExhausted(reg.registerInt(name + "z::approx::exhausted::exec")), + d_pivotsExhausted(reg.registerInt(name + "z::approx::exhausted::pivots")), + d_panicBranches(reg.registerInt(name + "z::arith::paniclemmas")), + d_relaxCalls(reg.registerInt(name + "z::arith::relax::calls")), + d_relaxLinFeas(reg.registerInt(name + "z::arith::relax::feasible::res")), + d_relaxLinFeasFailures( + reg.registerInt(name + "z::arith::relax::feasible::failures")), + d_relaxLinInfeas(reg.registerInt(name + "z::arith::relax::infeasible")), + d_relaxLinInfeasFailures( + reg.registerInt(name + "z::arith::relax::infeasible::failures")), + d_relaxLinExhausted(reg.registerInt(name + "z::arith::relax::exhausted")), + d_relaxOthers(reg.registerInt(name + "z::arith::relax::other")), + d_applyRowsDeleted( + reg.registerInt(name + "z::arith::cuts::applyRowsDeleted")), + d_replaySimplexTimer( + reg.registerTimer(name + "z::approx::replay::simplex::timer")), + d_replayLogTimer( + reg.registerTimer(name + "z::approx::replay::log::timer")), + d_solveIntTimer(reg.registerTimer(name + "z::solveInt::timer")), + d_solveRealRelaxTimer( + reg.registerTimer(name + "z::solveRealRelax::timer")), + d_solveIntCalls(reg.registerInt(name + "z::solveInt::calls")), + d_solveStandardEffort( + reg.registerInt(name + "z::solveInt::calls::standardEffort")), + d_approxDisabled(reg.registerInt(name + "z::approxDisabled")), + d_replayAttemptFailed(reg.registerInt(name + "z::replayAttemptFailed")), + d_cutsRejectedDuringReplay( + reg.registerInt(name + "z::approx::replay::cuts::rejected")), + d_cutsRejectedDuringLemmas( + reg.registerInt(name + "z::approx::external::cuts::rejected")), + d_satPivots(reg.registerHistogram<uint32_t>(name + "pivots::sat")), + d_unsatPivots(reg.registerHistogram<uint32_t>(name + "pivots::unsat")), + d_unknownPivots( + reg.registerHistogram<uint32_t>(name + "pivots::unknown")), + d_solveIntModelsAttempts( + reg.registerInt(name + "z::solveInt::models::attempts")), + d_solveIntModelsSuccessful( + reg.registerInt(name + "zzz::solveInt::models::successful")), + d_mipTimer(reg.registerTimer(name + "z::approx::mip::timer")), + d_lpTimer(reg.registerTimer(name + "z::approx::lp::timer")), + d_mipProofsAttempted(reg.registerInt(name + "z::mip::proofs::attempted")), + d_mipProofsSuccessful( + reg.registerInt(name + "z::mip::proofs::successful")), + d_numBranchesFailed( + reg.registerInt(name + "z::mip::branch::proof::failed")) { } diff --git a/src/theory/arith/theory_arith_private.h b/src/theory/arith/theory_arith_private.h index 173579cef..221c0a781 100644 --- a/src/theory/arith/theory_arith_private.h +++ b/src/theory/arith/theory_arith_private.h @@ -867,7 +867,7 @@ private: IntStat d_numBranchesFailed; - Statistics(const std::string& name); + Statistics(StatisticsRegistry& reg, const std::string& name); }; |