3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 09:35:32 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-08-27 15:05:35 -07:00
parent c6135a40d5
commit 872fd5e9ff
9 changed files with 125 additions and 43 deletions

View file

@ -22,6 +22,7 @@ Notes:
#include "util/lbool.h"
#include "util/statistics.h"
#include "util/event_handler.h"
#include "util/timer.h"
#include "tactic/model_converter.h"
/**
@ -41,8 +42,9 @@ protected:
unsigned m_ref_count;
lbool m_status;
model_converter_ref m_mc0;
double m_time;
public:
check_sat_result():m_ref_count(0), m_status(l_undef) {}
check_sat_result():m_ref_count(0), m_status(l_undef), m_time(0) {}
virtual ~check_sat_result() {}
void inc_ref() { m_ref_count++; }
void dec_ref() { SASSERT(m_ref_count > 0); m_ref_count--; if (m_ref_count == 0) dealloc(this); }
@ -64,6 +66,19 @@ public:
virtual void get_labels(svector<symbol> & r) = 0;
virtual ast_manager& get_manager() const = 0;
class scoped_solver_time {
check_sat_result& c;
timer t;
public:
scoped_solver_time(check_sat_result& c):c(c) { c.m_time = 0; }
~scoped_solver_time() { c.m_time = t.get_seconds(); }
};
void collect_timer_stats(statistics& st) const {
if (m_time != 0)
st.update("time", m_time);
}
};
/**
@ -76,7 +91,6 @@ struct simple_check_sat_result : public check_sat_result {
proof_ref m_proof;
std::string m_unknown;
simple_check_sat_result(ast_manager & m);
~simple_check_sat_result() override;
ast_manager& get_manager() const override { return m_proof.get_manager(); }

View file

@ -85,6 +85,7 @@ struct scoped_assumption_push {
};
lbool solver::get_consequences(expr_ref_vector const& asms, expr_ref_vector const& vars, expr_ref_vector& consequences) {
scoped_solver_time st(*this);
try {
return get_consequences_core(asms, vars, consequences);
}
@ -326,6 +327,7 @@ expr_ref_vector solver::get_non_units() {
lbool solver::check_sat(unsigned num_assumptions, expr * const * assumptions) {
lbool r = l_undef;
scoped_solver_time _st(*this);
try {
r = check_sat_core(num_assumptions, assumptions);
}