mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
moving to resource managed cancellation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
1aea9722cb
commit
521271e559
11 changed files with 34 additions and 48 deletions
|
@ -45,6 +45,7 @@ void reslimit::push(unsigned delta_limit) {
|
|||
}
|
||||
m_limits.push_back(m_limit);
|
||||
m_limit = m_limit==0?new_limit:std::min(new_limit, m_limit);
|
||||
m_cancel = false;
|
||||
}
|
||||
|
||||
void reslimit::pop() {
|
||||
|
@ -53,4 +54,5 @@ void reslimit::pop() {
|
|||
}
|
||||
m_limit = m_limits.back();
|
||||
m_limits.pop_back();
|
||||
m_cancel = false;
|
||||
}
|
||||
|
|
|
@ -227,16 +227,25 @@ double statistics::get_double_value(unsigned idx) const {
|
|||
return m_d_stats[idx - m_stats.size()].second;
|
||||
}
|
||||
|
||||
static void get_uint64_stats(statistics& st, char const* name, unsigned long long value) {
|
||||
if (value <= UINT_MAX) {
|
||||
st.update(name, static_cast<unsigned>(value));
|
||||
}
|
||||
else {
|
||||
st.update(name, static_cast<double>(value));
|
||||
}
|
||||
}
|
||||
|
||||
void get_memory_statistics(statistics& st) {
|
||||
unsigned long long max_mem = memory::get_max_used_memory();
|
||||
unsigned long long mem = memory::get_allocation_size();
|
||||
max_mem = (100*max_mem)/(1024*1024);
|
||||
mem = (100*mem)/(1024*1024);
|
||||
st.update("max memory", static_cast<double>(max_mem)/100.0);
|
||||
st.update("memory", static_cast<double>(mem)/100.0);
|
||||
st.update("num allocs", static_cast<double>(memory::get_allocation_count()));
|
||||
st.update("max memory", static_cast<double>(max_mem)/100.0);
|
||||
st.update("memory", static_cast<double>(mem)/100.0);
|
||||
get_uint64_stats(st, "num allocs", memory::get_allocation_count());
|
||||
}
|
||||
|
||||
void get_rlimit_statistics(reslimit& l, statistics& st) {
|
||||
st.update("rlimit count", static_cast<double>(l.count()));
|
||||
get_uint64_stats(st, "rlimit count", l.count());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue