mirror of
https://github.com/Z3Prover/z3
synced 2025-06-06 14:13:23 +00:00
add profiling option
This commit is contained in:
parent
c3eae9bf2a
commit
97a7ae1589
4 changed files with 22 additions and 4 deletions
|
@ -684,6 +684,7 @@ namespace Duality {
|
||||||
|
|
||||||
bool CandidateFeasible(const Candidate &cand){
|
bool CandidateFeasible(const Candidate &cand){
|
||||||
if(!FeasibleEdges) return true;
|
if(!FeasibleEdges) return true;
|
||||||
|
timer_start("CandidateFeasible");
|
||||||
RPFP *checker = new RPFP(rpfp->ls);
|
RPFP *checker = new RPFP(rpfp->ls);
|
||||||
// std::cout << "Checking feasibility of extension " << cand.edge->Parent->number << std::endl;
|
// std::cout << "Checking feasibility of extension " << cand.edge->Parent->number << std::endl;
|
||||||
checker->Push();
|
checker->Push();
|
||||||
|
@ -691,8 +692,10 @@ namespace Duality {
|
||||||
Node *root = checker->CloneNode(cand.edge->Parent);
|
Node *root = checker->CloneNode(cand.edge->Parent);
|
||||||
#ifdef BOUNDED
|
#ifdef BOUNDED
|
||||||
for(unsigned i = 0; i < cand.Children.size(); i++)
|
for(unsigned i = 0; i < cand.Children.size(); i++)
|
||||||
if(NodePastRecursionBound(cand.Children[i]))
|
if(NodePastRecursionBound(cand.Children[i])){
|
||||||
|
timer_stop("CandidateFeasible");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef NEW_CAND_SEL
|
#ifdef NEW_CAND_SEL
|
||||||
GenNodeSolutionFromIndSet(cand.edge->Parent,root->Bound);
|
GenNodeSolutionFromIndSet(cand.edge->Parent,root->Bound);
|
||||||
|
@ -710,6 +713,7 @@ namespace Duality {
|
||||||
if(!res)reporter->Reject(cand.edge,cand.Children);
|
if(!res)reporter->Reject(cand.edge,cand.Children);
|
||||||
checker->Pop(1);
|
checker->Pop(1);
|
||||||
delete checker;
|
delete checker;
|
||||||
|
timer_stop("CandidateFeasible");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -749,12 +753,15 @@ namespace Duality {
|
||||||
int StratifiedLeafCount;
|
int StratifiedLeafCount;
|
||||||
|
|
||||||
bool DoStratifiedInlining(){
|
bool DoStratifiedInlining(){
|
||||||
|
timer_start("StratifiedInlining");
|
||||||
DoTopoSort();
|
DoTopoSort();
|
||||||
for(unsigned i = 0; i < leaves.size(); i++){
|
for(unsigned i = 0; i < leaves.size(); i++){
|
||||||
Node *node = leaves[i];
|
Node *node = leaves[i];
|
||||||
bool res = SatisfyUpperBound(node);
|
bool res = SatisfyUpperBound(node);
|
||||||
if(!res)
|
if(!res){
|
||||||
|
timer_stop("StratifiedInlining");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// don't leave any dangling nodes!
|
// don't leave any dangling nodes!
|
||||||
#ifndef EFFORT_BOUNDED_STRAT
|
#ifndef EFFORT_BOUNDED_STRAT
|
||||||
|
@ -762,6 +769,7 @@ namespace Duality {
|
||||||
if(!leaves[i]->Outgoing)
|
if(!leaves[i]->Outgoing)
|
||||||
MakeLeaf(leaves[i],true);
|
MakeLeaf(leaves[i],true);
|
||||||
#endif
|
#endif
|
||||||
|
timer_stop("StratifiedInlining");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1333,6 +1341,7 @@ namespace Duality {
|
||||||
|
|
||||||
/** Extend the unwinding, keeping it solved. */
|
/** Extend the unwinding, keeping it solved. */
|
||||||
bool Extend(Candidate &cand){
|
bool Extend(Candidate &cand){
|
||||||
|
timer_start("Extend");
|
||||||
Node *node = CreateNodeInstance(cand.edge->Parent);
|
Node *node = CreateNodeInstance(cand.edge->Parent);
|
||||||
CreateEdgeInstance(cand.edge,node,cand.Children);
|
CreateEdgeInstance(cand.edge,node,cand.Children);
|
||||||
UpdateBackEdges(node);
|
UpdateBackEdges(node);
|
||||||
|
@ -1344,11 +1353,13 @@ namespace Duality {
|
||||||
ExpandUnderapproxNodes(cex.tree, cex.root);
|
ExpandUnderapproxNodes(cex.tree, cex.root);
|
||||||
#endif
|
#endif
|
||||||
if(UseUnderapprox) BuildFullCex(node);
|
if(UseUnderapprox) BuildFullCex(node);
|
||||||
|
timer_stop("Extend");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#ifdef EARLY_EXPAND
|
#ifdef EARLY_EXPAND
|
||||||
TryExpandNode(node);
|
TryExpandNode(node);
|
||||||
#endif
|
#endif
|
||||||
|
timer_stop("Extend");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ Revision History:
|
||||||
|
|
||||||
|
|
||||||
#include "duality.h"
|
#include "duality.h"
|
||||||
|
#include "duality_profiling.h"
|
||||||
|
|
||||||
// using namespace Duality;
|
// using namespace Duality;
|
||||||
|
|
||||||
|
@ -202,6 +203,11 @@ lbool dl_interface::query(::expr * query) {
|
||||||
// Solve!
|
// Solve!
|
||||||
bool ans = rs->Solve();
|
bool ans = rs->Solve();
|
||||||
|
|
||||||
|
// profile!
|
||||||
|
|
||||||
|
if(m_ctx.get_params().profile())
|
||||||
|
print_profile(std::cout);
|
||||||
|
|
||||||
// save the result and counterexample if there is one
|
// save the result and counterexample if there is one
|
||||||
_d->status = ans ? StatusModel : StatusRefutation;
|
_d->status = ans ? StatusModel : StatusRefutation;
|
||||||
_d->cex = rs->GetCounterexample();
|
_d->cex = rs->GetCounterexample();
|
||||||
|
|
|
@ -64,6 +64,7 @@ def_module_params('fixedpoint',
|
||||||
('use_underapprox', BOOL, False, 'DUALITY: Use underapproximations'),
|
('use_underapprox', BOOL, False, 'DUALITY: Use underapproximations'),
|
||||||
('stratified_inlining', BOOL, False, 'DUALITY: Use stratified inlining'),
|
('stratified_inlining', BOOL, False, 'DUALITY: Use stratified inlining'),
|
||||||
('recursion_bound', UINT, UINT_MAX, 'DUALITY: Recursion bound for stratified inlining'),
|
('recursion_bound', UINT, UINT_MAX, 'DUALITY: Recursion bound for stratified inlining'),
|
||||||
|
('profile', BOOL, False, 'DUALITY: profile run time'),
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue