mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
prepare polysat
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
3f5df04dc4
252 changed files with 5792 additions and 2553 deletions
|
@ -104,6 +104,7 @@ add_executable(test-z3
|
|||
sat_local_search.cpp
|
||||
sat_lookahead.cpp
|
||||
sat_user_scope.cpp
|
||||
scoped_timer.cpp
|
||||
simple_parser.cpp
|
||||
simplex.cpp
|
||||
simplifier.cpp
|
||||
|
|
|
@ -259,6 +259,7 @@ int main(int argc, char ** argv) {
|
|||
TST(bdd);
|
||||
TST(pdd);
|
||||
TST(pdd_solver);
|
||||
TST(scoped_timer);
|
||||
TST(solver_pool);
|
||||
//TST_ARGV(hs);
|
||||
TST(finder);
|
||||
|
|
52
src/test/scoped_timer.cpp
Normal file
52
src/test/scoped_timer.cpp
Normal file
|
@ -0,0 +1,52 @@
|
|||
// test driver for scoped timer.
|
||||
// fixes are required to be fuzzed
|
||||
// with single and multi-threaded mode and short timeouts.
|
||||
// run it with app-verifier (becuzz yes ...)
|
||||
|
||||
#include "util/scoped_timer.h"
|
||||
#include "util/util.h"
|
||||
#include "util/vector.h"
|
||||
#include "util/trace.h"
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
|
||||
class test_scoped_eh : public event_handler {
|
||||
std::atomic<bool> m_called = false;
|
||||
public:
|
||||
void operator()(event_handler_caller_t id) override {
|
||||
m_caller_id = id;
|
||||
m_called = true;
|
||||
}
|
||||
bool called() const { return m_called; }
|
||||
};
|
||||
|
||||
static void worker_thread(unsigned tid) {
|
||||
for (unsigned i = 0; i < 100; ++i) {
|
||||
test_scoped_eh eh;
|
||||
scoped_timer sc(1, &eh);
|
||||
unsigned_vector v;
|
||||
for (unsigned j = 0; j < (2 << 25); ++j) {
|
||||
v.push_back(j);
|
||||
if (eh.called()) {
|
||||
// IF_VERBOSE(0, verbose_stream() << tid << " " << i << " " << j << "\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tst_scoped_timer() {
|
||||
|
||||
std::cout << "sequential test\n";
|
||||
worker_thread(0);
|
||||
|
||||
std::cout << "thread test\n";
|
||||
unsigned num_threads = 3;
|
||||
vector<std::thread> threads(num_threads);
|
||||
for (unsigned i = 0; i < num_threads; ++i)
|
||||
threads[i] = std::thread([&, i]() { worker_thread(i); });
|
||||
|
||||
for (auto& th : threads)
|
||||
th.join();
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue