mirror of
https://github.com/Z3Prover/z3
synced 2025-11-05 13:56:03 +00:00
add a getter for solver stats. it compiles but still everything is untested
This commit is contained in:
parent
f9ae39ec49
commit
90abeb1fc0
3 changed files with 19 additions and 5 deletions
|
|
@ -113,11 +113,9 @@ namespace smt {
|
||||||
::statistics st;
|
::statistics st;
|
||||||
probe_ctx->collect_statistics(st);
|
probe_ctx->collect_statistics(st);
|
||||||
unsigned conflicts = 0, decisions = 0, rlimit = 0;
|
unsigned conflicts = 0, decisions = 0, rlimit = 0;
|
||||||
|
conflicts = st.get_val("conflicts");
|
||||||
// I can't figure out how to access the statistics fields, I only see an update method
|
decisions = st.get_val("decisions");
|
||||||
// st.get_uint("conflicts", conflicts);
|
rlimit = st.get_val("rlimit count");
|
||||||
// st.get_uint("decisions", decisions);
|
|
||||||
// st.get_uint("rlimit count", rlimit);
|
|
||||||
score += conflicts + decisions + rlimit;
|
score += conflicts + decisions + rlimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,21 @@ struct str_lt {
|
||||||
typedef map<char const *, unsigned, str_hash_proc, str_eq_proc> key2val;
|
typedef map<char const *, unsigned, str_hash_proc, str_eq_proc> key2val;
|
||||||
typedef map<char const *, double, str_hash_proc, str_eq_proc> key2dval;
|
typedef map<char const *, double, str_hash_proc, str_eq_proc> key2dval;
|
||||||
|
|
||||||
|
double statistics::get_val(char const * key) const {
|
||||||
|
key2val m_u;
|
||||||
|
key2dval m_d;
|
||||||
|
mk_map(m_stats, m_u);
|
||||||
|
mk_map(m_d_stats, m_d);
|
||||||
|
|
||||||
|
unsigned val = 0;
|
||||||
|
double dval = 0.0;
|
||||||
|
if (m_u.find(key, val))
|
||||||
|
return static_cast<double>(val);
|
||||||
|
if (m_d.find(key, dval))
|
||||||
|
return dval;
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned get_max_len(ptr_buffer<char> & keys) {
|
unsigned get_max_len(ptr_buffer<char> & keys) {
|
||||||
unsigned max = 0;
|
unsigned max = 0;
|
||||||
for (unsigned i = 0; i < static_cast<unsigned>(keys.size()); i++) {
|
for (unsigned i = 0; i < static_cast<unsigned>(keys.size()); i++) {
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ public:
|
||||||
char const * get_key(unsigned idx) const;
|
char const * get_key(unsigned idx) const;
|
||||||
unsigned get_uint_value(unsigned idx) const;
|
unsigned get_uint_value(unsigned idx) const;
|
||||||
double get_double_value(unsigned idx) const;
|
double get_double_value(unsigned idx) const;
|
||||||
|
double get_val(char const * key) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::ostream& operator<<(std::ostream& out, statistics const& st) { return st.display(out); }
|
inline std::ostream& operator<<(std::ostream& out, statistics const& st) { return st.display(out); }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue