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.
using namespace cvc5::theory;
BoolToBV::BoolToBV(PreprocessingPassContext* preprocContext)
- : PreprocessingPass(preprocContext, "bool-to-bv"), d_statistics()
+ : PreprocessingPass(preprocContext, "bool-to-bv"),
+ d_statistics(statisticsRegistry())
{
d_boolToBVMode = options().bv.boolToBitvector;
};
updateCache(n, builder.constructNode());
}
-BoolToBV::Statistics::Statistics()
- : d_numIteToBvite(smtStatisticsRegistry().registerInt(
- "preprocessing::passes::BoolToBV::NumIteToBvite")),
+BoolToBV::Statistics::Statistics(StatisticsRegistry& reg)
+ : d_numIteToBvite(
+ reg.registerInt("preprocessing::passes::BoolToBV::NumIteToBvite")),
// the following two statistics are not correct in the ITE mode, because
// we might discard rebuilt nodes if we fails to convert a bool to
// width-one bit-vector (never forces)
- d_numTermsLowered(smtStatisticsRegistry().registerInt(
- "preprocessing::passes:BoolToBV::NumTermsLowered")),
- d_numIntroducedItes(smtStatisticsRegistry().registerInt(
+ d_numTermsLowered(
+ reg.registerInt("preprocessing::passes:BoolToBV::NumTermsLowered")),
+ d_numIntroducedItes(reg.registerInt(
"preprocessing::passes::BoolToBV::NumTermsForcedLowered"))
{
}
IntStat d_numIteToBvite;
IntStat d_numTermsLowered;
IntStat d_numIntroducedItes;
- Statistics();
+ Statistics(StatisticsRegistry& reg);
};
/** Takes an assertion and attempts to create more bit-vector structure
d_boolCache(),
d_one(bv::utils::mkOne(1)),
d_zero(bv::utils::mkZero(1)),
- d_statistics(){};
+ d_statistics(statisticsRegistry()){};
PreprocessingPassResult BVToBool::applyInternal(
AssertionPipeline* assertionsToPreprocess)
}
}
-BVToBool::Statistics::Statistics()
- : d_numTermsLifted(smtStatisticsRegistry().registerInt(
- "preprocessing::passes::BVToBool::NumTermsLifted")),
- d_numAtomsLifted(smtStatisticsRegistry().registerInt(
- "preprocessing::passes::BVToBool::NumAtomsLifted")),
- d_numTermsForcedLifted(smtStatisticsRegistry().registerInt(
+BVToBool::Statistics::Statistics(StatisticsRegistry& reg)
+ : d_numTermsLifted(
+ reg.registerInt("preprocessing::passes::BVToBool::NumTermsLifted")),
+ d_numAtomsLifted(
+ reg.registerInt("preprocessing::passes::BVToBool::NumAtomsLifted")),
+ d_numTermsForcedLifted(reg.registerInt(
"preprocessing::passes::BVToBool::NumTermsForcedLifted"))
{
}
IntStat d_numTermsLifted;
IntStat d_numAtomsLifted;
IntStat d_numTermsForcedLifted;
- Statistics();
+ Statistics(StatisticsRegistry& reg);
};
void addToBoolCache(TNode term, Node new_term);
Node getBoolCache(TNode term) const;
/* -------------------------------------------------------------------------- */
-ITESimp::Statistics::Statistics()
- : d_arithSubstitutionsAdded(smtStatisticsRegistry().registerInt(
+ITESimp::Statistics::Statistics(StatisticsRegistry& reg)
+ : d_arithSubstitutionsAdded(reg.registerInt(
"preprocessing::passes::ITESimp::ArithSubstitutionsAdded"))
{
}
/* -------------------------------------------------------------------------- */
ITESimp::ITESimp(PreprocessingPassContext* preprocContext)
- : PreprocessingPass(preprocContext, "ite-simp"), d_iteUtilities(d_env)
+ : PreprocessingPass(preprocContext, "ite-simp"),
+ d_iteUtilities(d_env),
+ d_statistics(statisticsRegistry())
{
}
struct Statistics
{
IntStat d_arithSubstitutionsAdded;
- Statistics();
+ Statistics(StatisticsRegistry& reg);
};
Node simpITE(util::ITEUtilities* ite_utils, TNode assertion);
LearnedRewrite::LearnedRewrite(PreprocessingPassContext* preprocContext)
: PreprocessingPass(preprocContext, "learned-rewrite"),
- d_lrewCount(smtStatisticsRegistry().registerHistogram<LearnedRewriteId>(
+ d_lrewCount(statisticsRegistry().registerHistogram<LearnedRewriteId>(
"LearnedRewrite::lrewCount"))
{
}
} // namespace
MipLibTrick::MipLibTrick(PreprocessingPassContext* preprocContext)
- : PreprocessingPass(preprocContext, "miplib-trick")
+ : PreprocessingPass(preprocContext, "miplib-trick"),
+ d_statistics(statisticsRegistry())
{
if (!options().base.incrementalSolving)
{
return PreprocessingPassResult::NO_CONFLICT;
}
-MipLibTrick::Statistics::Statistics()
- : d_numMiplibAssertionsRemoved(smtStatisticsRegistry().registerInt(
+MipLibTrick::Statistics::Statistics(StatisticsRegistry& reg)
+ : d_numMiplibAssertionsRemoved(reg.registerInt(
"preprocessing::passes::MipLibTrick::numMiplibAssertionsRemoved"))
{
}
{
/** number of assertions removed by miplib pass */
IntStat d_numMiplibAssertionsRemoved;
- Statistics();
+ Statistics(StatisticsRegistry& reg);
};
size_t removeFromConjunction(
/* -------------------------------------------------------------------------- */
-NonClausalSimp::Statistics::Statistics()
- : d_numConstantProps(smtStatisticsRegistry().registerInt(
+NonClausalSimp::Statistics::Statistics(StatisticsRegistry& reg)
+ : d_numConstantProps(reg.registerInt(
"preprocessing::passes::NonClausalSimp::NumConstantProps"))
{
}
NonClausalSimp::NonClausalSimp(PreprocessingPassContext* preprocContext)
: PreprocessingPass(preprocContext, "non-clausal-simp"),
+ d_statistics(statisticsRegistry()),
d_pnm(preprocContext->getProofNodeManager()),
d_llpg(d_pnm ? new smt::PreprocessProofGenerator(
d_pnm, userContext(), "NonClausalSimp::llpg")
struct Statistics
{
IntStat d_numConstantProps;
- Statistics();
+ Statistics(StatisticsRegistry& reg);
};
Statistics d_statistics;
UnconstrainedSimplifier::UnconstrainedSimplifier(
PreprocessingPassContext* preprocContext)
: PreprocessingPass(preprocContext, "unconstrained-simplifier"),
- d_numUnconstrainedElim(smtStatisticsRegistry().registerInt(
+ d_numUnconstrainedElim(statisticsRegistry().registerInt(
"preprocessor::number of unconstrained elims")),
d_context(context()),
d_substitutions(context())
: EnvObj(preprocContext->getEnv()),
d_preprocContext(preprocContext),
d_name(name),
- d_timer(smtStatisticsRegistry().registerTimer("preprocessing::" + name))
+ d_timer(statisticsRegistry().registerTimer("preprocessing::" + name))
{
}
: EnvObj(env),
d_contains(contains),
d_assertions(NULL),
- d_incoming(true, true)
+ d_incoming(true, true),
+ d_statistics(env.getStatisticsRegistry())
{
Assert(d_contains != NULL);
void ITECompressor::garbageCollect() { reset(); }
-ITECompressor::Statistics::Statistics()
- : d_compressCalls(
- smtStatisticsRegistry().registerInt("ite-simp::compressCalls")),
- d_skolemsAdded(smtStatisticsRegistry().registerInt("ite-simp::skolems"))
+ITECompressor::Statistics::Statistics(StatisticsRegistry& reg)
+ : d_compressCalls(reg.registerInt("ite-simp::compressCalls")),
+ d_skolemsAdded(reg.registerInt("ite-simp::skolems"))
{
}
d_leavesConstCache(),
d_simpConstCache(),
d_simpContextCache(),
- d_simpITECache()
+ d_simpITECache(),
+ d_statistics(env.getStatisticsRegistry())
{
Assert(d_containsVisitor != NULL);
d_true = NodeManager::currentNM()->mkConst<bool>(true);
return (d_citeEqConstApplications > SIZE_BOUND);
}
-ITESimplifier::Statistics::Statistics()
+ITESimplifier::Statistics::Statistics(StatisticsRegistry& reg)
: d_maxNonConstantsFolded(
- smtStatisticsRegistry().registerInt("ite-simp::maxNonConstantsFolded")),
- d_unexpected(smtStatisticsRegistry().registerInt("ite-simp::unexpected")),
- d_unsimplified(
- smtStatisticsRegistry().registerInt("ite-simp::unsimplified")),
- d_exactMatchFold(
- smtStatisticsRegistry().registerInt("ite-simp::exactMatchFold")),
- d_binaryPredFold(
- smtStatisticsRegistry().registerInt("ite-simp::binaryPredFold")),
- d_specialEqualityFolds(smtStatisticsRegistry().registerInt(
- "ite-simp::specialEqualityFolds")),
- d_simpITEVisits(
- smtStatisticsRegistry().registerInt("ite-simp::simpITE.visits")),
- d_inSmaller(smtStatisticsRegistry().registerHistogram<uint32_t>(
- "ite-simp::inSmaller"))
+ reg.registerInt("ite-simp::maxNonConstantsFolded")),
+ d_unexpected(reg.registerInt("ite-simp::unexpected")),
+ d_unsimplified(reg.registerInt("ite-simp::unsimplified")),
+ d_exactMatchFold(reg.registerInt("ite-simp::exactMatchFold")),
+ d_binaryPredFold(reg.registerInt("ite-simp::binaryPredFold")),
+ d_specialEqualityFolds(reg.registerInt("ite-simp::specialEqualityFolds")),
+ d_simpITEVisits(reg.registerInt("ite-simp::simpITE.visits")),
+ d_inSmaller(reg.registerHistogram<uint32_t>("ite-simp::inSmaller"))
{
}
public:
IntStat d_compressCalls;
IntStat d_skolemsAdded;
- Statistics();
+ Statistics(StatisticsRegistry& reg);
};
void reset();
HistogramStat<uint32_t> d_inSmaller;
- Statistics();
+ Statistics(StatisticsRegistry& reg);
};
inline bool containsTermITE(TNode n)
d_topLevelSubs(new theory::TrustSubstitutionMap(d_userContext.get())),
d_dumpManager(new DumpManager(d_userContext.get())),
d_logic(),
- d_statisticsRegistry(std::make_unique<StatisticsRegistry>()),
+ d_statisticsRegistry(std::make_unique<StatisticsRegistry>(*this)),
d_options(),
d_originalOptions(opts),
d_resourceManager()
return d_env.getUserContext();
}
+StatisticsRegistry& EnvObj::statisticsRegistry() const
+{
+ return d_env.getStatisticsRegistry();
+}
+
} // namespace cvc5
class LogicInfo;
class NodeManager;
class Options;
+class StatisticsRegistry;
namespace context {
class Context;
/** Get a pointer to the UserContext via Env. */
context::UserContext* userContext() const;
+ /** Get the statistics registry via Env. */
+ StatisticsRegistry& statisticsRegistry() const;
+
/** The associated environment. */
Env& d_env;
};
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),
d_solveIntAttempts(0u),
d_newFacts(false),
d_previousStatus(Result::SAT_UNKNOWN),
- d_statistics("theory::arith::")
+ d_statistics(statisticsRegistry(), "theory::arith::")
{
}
}
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"))
{
}
IntStat d_numBranchesFailed;
- Statistics(const std::string& name);
+ Statistics(StatisticsRegistry& reg, const std::string& name);
};
Valuation valuation,
std::string name)
: Theory(THEORY_ARRAYS, env, out, valuation, name),
- d_numRow(
- smtStatisticsRegistry().registerInt(name + "number of Row lemmas")),
- d_numExt(
- smtStatisticsRegistry().registerInt(name + "number of Ext lemmas")),
+ d_numRow(statisticsRegistry().registerInt(name + "number of Row lemmas")),
+ d_numExt(statisticsRegistry().registerInt(name + "number of Ext lemmas")),
d_numProp(
- smtStatisticsRegistry().registerInt(name + "number of propagations")),
+ statisticsRegistry().registerInt(name + "number of propagations")),
d_numExplain(
- smtStatisticsRegistry().registerInt(name + "number of explanations")),
- d_numNonLinear(smtStatisticsRegistry().registerInt(
+ statisticsRegistry().registerInt(name + "number of explanations")),
+ d_numNonLinear(statisticsRegistry().registerInt(
name + "number of calls to setNonLinear")),
- d_numSharedArrayVarSplits(smtStatisticsRegistry().registerInt(
+ d_numSharedArrayVarSplits(statisticsRegistry().registerInt(
name + "number of shared array var splits")),
- d_numGetModelValSplits(smtStatisticsRegistry().registerInt(
+ d_numGetModelValSplits(statisticsRegistry().registerInt(
name + "number of getModelVal splits")),
- d_numGetModelValConflicts(smtStatisticsRegistry().registerInt(
+ d_numGetModelValConflicts(statisticsRegistry().registerInt(
name + "number of getModelVal conflicts")),
- d_numSetModelValSplits(smtStatisticsRegistry().registerInt(
+ d_numSetModelValSplits(statisticsRegistry().registerInt(
name + "number of setModelVal splits")),
- d_numSetModelValConflicts(smtStatisticsRegistry().registerInt(
+ d_numSetModelValConflicts(statisticsRegistry().registerInt(
name + "number of setModelVal conflicts")),
d_ppEqualityEngine(userContext(), name + "pp", true),
d_ppFacts(userContext()),
d_im(env, *this, d_state, nullptr, "theory::bv::"),
d_notify(d_im),
d_invalidateModelCache(context(), true),
- d_stats("theory::bv::")
+ d_stats(statisticsRegistry(), "theory::bv::")
{
switch (options().bv.bvSolver)
{
return it->second;
}
-TheoryBV::Statistics::Statistics(const std::string& name)
- : d_solveSubstitutions(
- smtStatisticsRegistry().registerInt(name + "NumSolveSubstitutions"))
+TheoryBV::Statistics::Statistics(StatisticsRegistry& reg,
+ const std::string& name)
+ : d_solveSubstitutions(reg.registerInt(name + "NumSolveSubstitutions"))
{
}
/** TheoryBV statistics. */
struct Statistics
{
- Statistics(const std::string& name);
+ Statistics(StatisticsRegistry& reg, const std::string& name);
IntStat d_solveSubstitutions;
} d_stats;
d_sharedTermsIndex(d_env.getContext(), 0),
d_careGraph(nullptr),
d_instanceName(name),
- d_checkTime(smtStatisticsRegistry().registerTimer(getStatsPrefix(id)
- + name + "checkTime")),
- d_computeCareGraphTime(smtStatisticsRegistry().registerTimer(
+ d_checkTime(statisticsRegistry().registerTimer(getStatsPrefix(id) + name
+ + "checkTime")),
+ d_computeCareGraphTime(statisticsRegistry().registerTimer(
getStatsPrefix(id) + name + "computeCareGraphTime")),
d_sharedTerms(d_env.getContext()),
d_out(&out),
d_propagatedLiterals(context()),
d_propagatedLiteralsIndex(context(), 0),
d_atomRequests(context()),
- d_combineTheoriesTime(smtStatisticsRegistry().registerTimer(
+ d_combineTheoriesTime(statisticsRegistry().registerTimer(
"TheoryEngine::combineTheoriesTime")),
d_true(),
d_false(),
d_numConflicts(0),
d_numCurrentLemmas(0),
d_numCurrentFacts(0),
- d_conflictIdStats(smtStatisticsRegistry().registerHistogram<InferenceId>(
+ d_conflictIdStats(statisticsRegistry().registerHistogram<InferenceId>(
statsName + "inferencesConflict")),
- d_factIdStats(smtStatisticsRegistry().registerHistogram<InferenceId>(
+ d_factIdStats(statisticsRegistry().registerHistogram<InferenceId>(
statsName + "inferencesFact")),
- d_lemmaIdStats(smtStatisticsRegistry().registerHistogram<InferenceId>(
+ d_lemmaIdStats(statisticsRegistry().registerHistogram<InferenceId>(
statsName + "inferencesLemma"))
{
// don't add true lemma
namespace cvc5 {
-StatisticsRegistry::StatisticsRegistry(bool registerPublic)
+StatisticsRegistry::StatisticsRegistry(Env& env, bool registerPublic)
+ : EnvObj(env)
{
if (registerPublic)
{
d_lastSnapshot = std::make_unique<Snapshot>();
for (const auto& s : d_stats)
{
- if (!options::statisticsExpert() && s.second->d_expert) continue;
- if (!options::statisticsAll() && s.second->isDefault()) continue;
+ if (!options().base.statisticsExpert && s.second->d_expert) continue;
+ if (!options().base.statisticsAll && s.second->isDefault()) continue;
d_lastSnapshot->emplace(
s.first,
s.second->getViewer());
{
for (const auto& s : d_stats)
{
- if (!options::statisticsExpert() && s.second->d_expert) continue;
- if (!options::statisticsAll() && s.second->isDefault()) continue;
+ if (!options().base.statisticsExpert && s.second->d_expert) continue;
+ if (!options().base.statisticsAll && s.second->isDefault()) continue;
os << s.first << " = " << *s.second << std::endl;
}
}
{
for (const auto& s : d_stats)
{
- if (!options::statisticsExpert() && s.second->d_expert) continue;
- if (!options::statisticsAll() && s.second->isDefault()) continue;
+ if (!options().base.statisticsExpert && s.second->d_expert) continue;
+ if (!options().base.statisticsAll && s.second->isDefault()) continue;
safe_print(fd, s.first);
safe_print(fd, " = ");
}
for (const auto& s : d_stats)
{
- if (!options::statisticsExpert() && s.second->d_expert) continue;
- if (!options::statisticsAll() && s.second->isDefault())
+ if (!options().base.statisticsExpert && s.second->d_expert) continue;
+ if (!options().base.statisticsAll && s.second->isDefault())
{
auto oldit = d_lastSnapshot->find(s.first);
if (oldit != d_lastSnapshot->end() && oldit->second != s.second->getViewer())
#include <typeinfo>
#include "base/check.h"
+#include "smt/env_obj.h"
#include "util/statistics_stats.h"
#include "util/statistics_value.h"
* However, no data is stored in the registry and the modification functions
* of the proxy objects do nothing.
*/
-class StatisticsRegistry
+class StatisticsRegistry : protected EnvObj
{
public:
friend std::ostream& operator<<(std::ostream& os,
* pre-registered as such. This argument mostly exists so that unit tests
* can disable this pre-registration.
*/
- StatisticsRegistry(bool registerPublic = true);
+ StatisticsRegistry(Env& env, bool registerPublic = true);
/** Register a new running average statistic for `name` */
--- /dev/null
+/******************************************************************************
+ * Top contributors (to current version):
+ * Aina Niemetz, Andrew Reynolds
+ *
+ * This file is part of the cvc5 project.
+ *
+ * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
+ * in the top-level source directory and their institutional affiliations.
+ * All rights reserved. See the file COPYING in the top-level source
+ * directory for licensing information.
+ * ****************************************************************************
+ *
+ * Common header for unit tests involving env.
+ */
+
+#ifndef CVC5__TEST__UNIT__TEST_NODE_H
+#define CVC5__TEST__UNIT__TEST_NODE_H
+
+#include "expr/node_manager.h"
+#include "expr/skolem_manager.h"
+#include "options/options.h"
+#include "smt/env.h"
+#include "smt/smt_engine.h"
+#include "smt/smt_engine_scope.h"
+#include "test.h"
+
+namespace cvc5 {
+namespace test {
+
+class TestEnv : public TestInternal
+{
+ protected:
+ void SetUp() override
+ {
+ d_options.reset(new Options());
+ d_nodeManager.reset(new NodeManager());
+ d_env.reset(new Env(d_nodeManager.get(), d_options.get()));
+ }
+
+
+ std::unique_ptr<Options> d_options;
+ std::unique_ptr<NodeManager> d_nodeManager;
+ std::unique_ptr<Env> d_env;
+};
+
+} // namespace test
+} // namespace cvc5
+#endif
#include "lib/clock_gettime.h"
#include "proof/proof_rule.h"
-#include "test.h"
+#include "test_env.h"
#include "util/statistics_registry.h"
#include "util/statistics_stats.h"
namespace test {
-class TestUtilBlackStats : public TestInternal
+class TestUtilBlackStats : public TestEnv
{
};
TEST_F(TestUtilBlackStats, stats)
{
#ifdef CVC5_STATISTICS_ON
- StatisticsRegistry reg(false);
+ StatisticsRegistry reg(*d_env.get(), false);
std::string empty, bar = "bar", baz = "baz";
AverageStat avg = reg.registerAverage("avg");