diff options
author | Tim King <taking@google.com> | 2016-01-08 16:44:57 -0800 |
---|---|---|
committer | Tim King <taking@google.com> | 2016-01-08 16:44:57 -0800 |
commit | f4ef7af0a2295691f281ee1604dfeb4082fe229c (patch) | |
tree | 995e512e5669cec6bbc9447d00ec912d5e4c19e3 /src/prop/bvminisat/bvminisat.cpp | |
parent | def0a07f9676a292a849d7fc8269ffd0901ce156 (diff) |
Removing StatisticsRegistry's static functions current() and registerStat().
- The functionality the get the StatisticsRegistry attached to the SmtEngine was previously through StatisticsRegistry::current(). This is the dominant StatisticsRegistry in the code. (There is another StatisticsRegistry attached to the NodeManager.) Having this be a static function on StatisticsRegistry requires the use of an SmtEngine in the wrong compilation unit.
- Usages of StatisticsRegistry::current() that were visible in prop/{bvminisat,minisat} has been removed. A pointer to the relevant StatisticsRegistry should be passed instead into the constructor.
- The function StatisticsRegistry::current() has been replaced by SmtScope::currentStatisticsRegistry(). SmtScope is in the libcvc4 package, where SmtEngine is available in the compilation unit.
- The function smtStatisticsRegistry() is a synonym for SmtScope::currentStatisticsRegistry() in smt/smt_statistics_registry.h. This header has fewer include dependencies than the one for SmtScope.
- Correspondingly, the static functions StatisticsRegistry::{registerStat, unregisterStat} have been removed. One should instead use smtStatisticsRegistry()->{registerStat,unregisterStat} instead.
- The KEEP_STATISTIC macro has been moved into smt/smt_statistics_registry.h.
- Documents the reason StatisticsRegistry is CVC4_PUBLIC. This lets me remove the warning I added.
- Removing most operators for timespec from statistics_registry.h file. These a bit error prone in clang.
- Most of the really confusing ifdef's in util/statistics_registry.h are gone.
Diffstat (limited to 'src/prop/bvminisat/bvminisat.cpp')
-rw-r--r-- | src/prop/bvminisat/bvminisat.cpp | 103 |
1 files changed, 56 insertions, 47 deletions
diff --git a/src/prop/bvminisat/bvminisat.cpp b/src/prop/bvminisat/bvminisat.cpp index ab157844a..be266b6d8 100644 --- a/src/prop/bvminisat/bvminisat.cpp +++ b/src/prop/bvminisat/bvminisat.cpp @@ -17,21 +17,23 @@ **/ #include "prop/bvminisat/bvminisat.h" + #include "prop/bvminisat/simp/SimpSolver.h" +#include "util/statistics_registry.h" -using namespace CVC4; -using namespace prop; +namespace CVC4 { +namespace prop { -BVMinisatSatSolver::BVMinisatSatSolver(context::Context* mainSatContext, const std::string& name) +BVMinisatSatSolver::BVMinisatSatSolver(StatisticsRegistry* registry, context::Context* mainSatContext, const std::string& name) : context::ContextNotifyObj(mainSatContext, false), d_minisat(new BVMinisat::SimpSolver(mainSatContext)), d_minisatNotify(0), d_assertionsCount(0), d_assertionsRealCount(mainSatContext, 0), d_lastPropagation(mainSatContext, 0), - d_statistics(name) + d_statistics(registry, name) { - d_statistics.init(d_minisat); + d_statistics.init(d_minisat); } @@ -208,59 +210,63 @@ void BVMinisatSatSolver::toSatClause(BVMinisat::vec<BVMinisat::Lit>& clause, // Satistics for BVMinisatSatSolver -BVMinisatSatSolver::Statistics::Statistics(const std::string& prefix) : - d_statStarts("theory::bv::"+prefix+"bvminisat::starts"), - d_statDecisions("theory::bv::"+prefix+"bvminisat::decisions"), - d_statRndDecisions("theory::bv::"+prefix+"bvminisat::rnd_decisions"), - d_statPropagations("theory::bv::"+prefix+"bvminisat::propagations"), - d_statConflicts("theory::bv::"+prefix+"bvminisat::conflicts"), - d_statClausesLiterals("theory::bv::"+prefix+"bvminisat::clauses_literals"), - d_statLearntsLiterals("theory::bv::"+prefix+"bvminisat::learnts_literals"), - d_statMaxLiterals("theory::bv::"+prefix+"bvminisat::max_literals"), - d_statTotLiterals("theory::bv::"+prefix+"bvminisat::tot_literals"), - d_statEliminatedVars("theory::bv::"+prefix+"bvminisat::eliminated_vars"), - d_statCallsToSolve("theory::bv::"+prefix+"bvminisat::calls_to_solve", 0), - d_statSolveTime("theory::bv::"+prefix+"bvminisat::solve_time", 0), - d_registerStats(!prefix.empty()) +BVMinisatSatSolver::Statistics::Statistics(StatisticsRegistry* registry, const std::string& prefix) + : d_registry(registry), + d_statStarts("theory::bv::"+prefix+"bvminisat::starts"), + d_statDecisions("theory::bv::"+prefix+"bvminisat::decisions"), + d_statRndDecisions("theory::bv::"+prefix+"bvminisat::rnd_decisions"), + d_statPropagations("theory::bv::"+prefix+"bvminisat::propagations"), + d_statConflicts("theory::bv::"+prefix+"bvminisat::conflicts"), + d_statClausesLiterals("theory::bv::"+prefix+"bvminisat::clauses_literals"), + d_statLearntsLiterals("theory::bv::"+prefix+"bvminisat::learnts_literals"), + d_statMaxLiterals("theory::bv::"+prefix+"bvminisat::max_literals"), + d_statTotLiterals("theory::bv::"+prefix+"bvminisat::tot_literals"), + d_statEliminatedVars("theory::bv::"+prefix+"bvminisat::eliminated_vars"), + d_statCallsToSolve("theory::bv::"+prefix+"bvminisat::calls_to_solve", 0), + d_statSolveTime("theory::bv::"+prefix+"bvminisat::solve_time", 0), + d_registerStats(!prefix.empty()) { - if (!d_registerStats) + if (!d_registerStats){ return; + } - StatisticsRegistry::registerStat(&d_statStarts); - StatisticsRegistry::registerStat(&d_statDecisions); - StatisticsRegistry::registerStat(&d_statRndDecisions); - StatisticsRegistry::registerStat(&d_statPropagations); - StatisticsRegistry::registerStat(&d_statConflicts); - StatisticsRegistry::registerStat(&d_statClausesLiterals); - StatisticsRegistry::registerStat(&d_statLearntsLiterals); - StatisticsRegistry::registerStat(&d_statMaxLiterals); - StatisticsRegistry::registerStat(&d_statTotLiterals); - StatisticsRegistry::registerStat(&d_statEliminatedVars); - StatisticsRegistry::registerStat(&d_statCallsToSolve); - StatisticsRegistry::registerStat(&d_statSolveTime); + d_registry->registerStat(&d_statStarts); + d_registry->registerStat(&d_statDecisions); + d_registry->registerStat(&d_statRndDecisions); + d_registry->registerStat(&d_statPropagations); + d_registry->registerStat(&d_statConflicts); + d_registry->registerStat(&d_statClausesLiterals); + d_registry->registerStat(&d_statLearntsLiterals); + d_registry->registerStat(&d_statMaxLiterals); + d_registry->registerStat(&d_statTotLiterals); + d_registry->registerStat(&d_statEliminatedVars); + d_registry->registerStat(&d_statCallsToSolve); + d_registry->registerStat(&d_statSolveTime); } BVMinisatSatSolver::Statistics::~Statistics() { - if (!d_registerStats) + if (!d_registerStats){ return; - StatisticsRegistry::unregisterStat(&d_statStarts); - StatisticsRegistry::unregisterStat(&d_statDecisions); - StatisticsRegistry::unregisterStat(&d_statRndDecisions); - StatisticsRegistry::unregisterStat(&d_statPropagations); - StatisticsRegistry::unregisterStat(&d_statConflicts); - StatisticsRegistry::unregisterStat(&d_statClausesLiterals); - StatisticsRegistry::unregisterStat(&d_statLearntsLiterals); - StatisticsRegistry::unregisterStat(&d_statMaxLiterals); - StatisticsRegistry::unregisterStat(&d_statTotLiterals); - StatisticsRegistry::unregisterStat(&d_statEliminatedVars); - StatisticsRegistry::unregisterStat(&d_statCallsToSolve); - StatisticsRegistry::unregisterStat(&d_statSolveTime); + } + d_registry->unregisterStat(&d_statStarts); + d_registry->unregisterStat(&d_statDecisions); + d_registry->unregisterStat(&d_statRndDecisions); + d_registry->unregisterStat(&d_statPropagations); + d_registry->unregisterStat(&d_statConflicts); + d_registry->unregisterStat(&d_statClausesLiterals); + d_registry->unregisterStat(&d_statLearntsLiterals); + d_registry->unregisterStat(&d_statMaxLiterals); + d_registry->unregisterStat(&d_statTotLiterals); + d_registry->unregisterStat(&d_statEliminatedVars); + d_registry->unregisterStat(&d_statCallsToSolve); + d_registry->unregisterStat(&d_statSolveTime); } void BVMinisatSatSolver::Statistics::init(BVMinisat::SimpSolver* minisat){ - if (!d_registerStats) + if (!d_registerStats){ return; - + } + d_statStarts.setData(minisat->starts); d_statDecisions.setData(minisat->decisions); d_statRndDecisions.setData(minisat->rnd_decisions); @@ -272,3 +278,6 @@ void BVMinisatSatSolver::Statistics::init(BVMinisat::SimpSolver* minisat){ d_statTotLiterals.setData(minisat->tot_literals); d_statEliminatedVars.setData(minisat->eliminated_vars); } + +} /* namespace CVC4::prop */ +} /* namespace CVC4 */ |