This PR adds a reset() method to the ReferenceStat class. It then uses it to properly reset such statistics in the minisat solvers where lifetime is an issue.
d_statistics.init(d_minisat.get());
}
-
-BVMinisatSatSolver::~BVMinisatSatSolver() {
-}
+BVMinisatSatSolver::~BVMinisatSatSolver() { d_statistics.deinit(); }
void BVMinisatSatSolver::MinisatNotify::notify(
BVMinisat::vec<BVMinisat::Lit>& clause)
d_statEliminatedVars.set(minisat->eliminated_vars);
}
+void BVMinisatSatSolver::Statistics::deinit()
+{
+ if (!d_registerStats)
+ {
+ return;
+ }
+
+ d_statStarts.reset();
+ d_statDecisions.reset();
+ d_statRndDecisions.reset();
+ d_statPropagations.reset();
+ d_statConflicts.reset();
+ d_statClausesLiterals.reset();
+ d_statLearntsLiterals.reset();
+ d_statMaxLiterals.reset();
+ d_statTotLiterals.reset();
+ d_statEliminatedVars.reset();
+}
+
} // namespace prop
} // namespace cvc5
bool d_registerStats;
Statistics(StatisticsRegistry& registry, const std::string& prefix);
void init(BVMinisat::SimpSolver* minisat);
+ void deinit();
};
Statistics d_statistics;
MinisatSatSolver::~MinisatSatSolver()
{
+ d_statistics.deinit();
delete d_minisat;
}
d_statMaxLiterals.set(minisat->max_literals);
d_statTotLiterals.set(minisat->tot_literals);
}
+void MinisatSatSolver::Statistics::deinit()
+{
+ d_statStarts.reset();
+ d_statDecisions.reset();
+ d_statRndDecisions.reset();
+ d_statPropagations.reset();
+ d_statConflicts.reset();
+ d_statClausesLiterals.reset();
+ d_statLearntsLiterals.reset();
+ d_statMaxLiterals.reset();
+ d_statTotLiterals.reset();
+}
} // namespace prop
} // namespace cvc5
public:
Statistics(StatisticsRegistry& registry);
void init(Minisat::SimpSolver* d_minisat);
+ void deinit();
};/* class MinisatSatSolver::Statistics */
Statistics d_statistics;
d_data->d_value = &t;
}
}
+ /** Commit the value currently pointed to and release it. */
+ void reset()
+ {
+ if constexpr (Configuration::isStatisticsBuild())
+ {
+ d_data->commit();
+ d_data->d_value = nullptr;
+ }
+ }
/** Copy the current value of the referenced object. */
~ReferenceStat()
{