diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-05-27 15:09:23 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-05-27 15:09:23 -0700 |
commit | 19c25fd6aab057b2373717f996fe538507c1b1e1 (patch) | |
tree | 7aa7cd7609a5de31d11b3455b6388fd9300c8d0f /src/opt/sfm | |
parent | 94356f0d1fa8e671303299717f631ecf0ca2f17e (diff) | |
download | abc-19c25fd6aab057b2373717f996fe538507c1b1e1.tar.gz abc-19c25fd6aab057b2373717f996fe538507c1b1e1.tar.bz2 abc-19c25fd6aab057b2373717f996fe538507c1b1e1.zip |
Adding a wrapper around clock() for more accurate time counting in ABC.
Diffstat (limited to 'src/opt/sfm')
-rw-r--r-- | src/opt/sfm/sfmCore.c | 14 | ||||
-rw-r--r-- | src/opt/sfm/sfmInt.h | 14 | ||||
-rw-r--r-- | src/opt/sfm/sfmSat.c | 4 | ||||
-rw-r--r-- | src/opt/sfm/sfmWin.c | 10 |
4 files changed, 21 insertions, 21 deletions
diff --git a/src/opt/sfm/sfmCore.c b/src/opt/sfm/sfmCore.c index 7032c7dd..865db096 100644 --- a/src/opt/sfm/sfmCore.c +++ b/src/opt/sfm/sfmCore.c @@ -111,7 +111,7 @@ int Sfm_NodeResubSolve( Sfm_Ntk_t * p, int iNode, int f, int fRemoveOnly ) int fVeryVerbose = 0;//p->pPars->fVeryVerbose && Vec_IntSize(p->vDivs) < 200;// || pNode->Id == 556; int i, iFanin, iVar = -1; word uTruth, uSign, uMask; - clock_t clk; + abctime clk; assert( Sfm_ObjIsNode(p, iNode) ); assert( f >= 0 && f < Sfm_ObjFaninNum(p, iNode) ); p->nTryRemoves++; @@ -128,9 +128,9 @@ int Sfm_NodeResubSolve( Sfm_Ntk_t * p, int iNode, int f, int fRemoveOnly ) Sfm_ObjForEachFanin( p, iNode, iFanin, i ) if ( i != f ) Vec_IntPush( p->vDivIds, Sfm_ObjSatVar(p, iFanin) ); -clk = clock(); +clk = Abc_Clock(); uTruth = Sfm_ComputeInterpolant( p ); -p->timeSat += clock() - clk; +p->timeSat += Abc_Clock() - clk; // analyze outcomes if ( uTruth == SFM_SAT_UNDEC ) { @@ -169,9 +169,9 @@ p->timeSat += clock() - clk; return 0; // try replacing the critical fanin Vec_IntPush( p->vDivIds, Sfm_ObjSatVar(p, Vec_IntEntry(p->vDivs, iVar)) ); -clk = clock(); +clk = Abc_Clock(); uTruth = Sfm_ComputeInterpolant( p ); -p->timeSat += clock() - clk; +p->timeSat += Abc_Clock() - clk; // analyze outcomes if ( uTruth == SFM_SAT_UNDEC ) { @@ -254,7 +254,7 @@ int Sfm_NodeResub( Sfm_Ntk_t * p, int iNode ) int Sfm_NtkPerform( Sfm_Ntk_t * p, Sfm_Par_t * pPars ) { int i, k, Counter = 0; - p->timeTotal = clock(); + p->timeTotal = Abc_Clock(); if ( pPars->fVerbose ) printf( "Performing MFS with %d fixed objects.\n", Vec_StrSum(p->vFixed) ); p->pPars = pPars; @@ -280,7 +280,7 @@ int Sfm_NtkPerform( Sfm_Ntk_t * p, Sfm_Par_t * pPars ) } p->nTotalNodesEnd = Vec_WecSizeUsed(&p->vFanins) - Sfm_NtkPoNum(p); p->nTotalEdgesEnd = Vec_WecSizeSize(&p->vFanins) - Sfm_NtkPoNum(p); - p->timeTotal = clock() - p->timeTotal; + p->timeTotal = Abc_Clock() - p->timeTotal; if ( pPars->fVerbose ) Sfm_NtkPrintStats( p ); return Counter; diff --git a/src/opt/sfm/sfmInt.h b/src/opt/sfm/sfmInt.h index 8b0072f1..d918077c 100644 --- a/src/opt/sfm/sfmInt.h +++ b/src/opt/sfm/sfmInt.h @@ -112,13 +112,13 @@ struct Sfm_Ntk_t_ int nTimeOuts; int nMaxDivs; // runtime - clock_t timeWin; - clock_t timeDiv; - clock_t timeCnf; - clock_t timeSat; - clock_t timeOther; - clock_t timeTotal; -// clock_t time1; + abctime timeWin; + abctime timeDiv; + abctime timeCnf; + abctime timeSat; + abctime timeOther; + abctime timeTotal; +// abctime time1; }; static inline int Sfm_NtkPiNum( Sfm_Ntk_t * p ) { return p->nPis; } diff --git a/src/opt/sfm/sfmSat.c b/src/opt/sfm/sfmSat.c index 01b9d4cf..f96e2078 100644 --- a/src/opt/sfm/sfmSat.c +++ b/src/opt/sfm/sfmSat.c @@ -55,7 +55,7 @@ void Sfm_NtkWindowToSolver( Sfm_Ntk_t * p ) { Vec_Int_t * vClause; int RetValue, iNode = -1, iFanin, i, k; - clock_t clk = clock(); + abctime clk = Abc_Clock(); // if ( p->pSat ) // printf( "%d ", p->pSat->stats.learnts ); sat_solver_restart( p->pSat ); @@ -93,7 +93,7 @@ void Sfm_NtkWindowToSolver( Sfm_Ntk_t * p ) // finalize RetValue = sat_solver_simplify( p->pSat ); assert( RetValue ); - p->timeCnf += clock() - clk; + p->timeCnf += Abc_Clock() - clk; } /**Function************************************************************* diff --git a/src/opt/sfm/sfmWin.c b/src/opt/sfm/sfmWin.c index 9efe30d3..9f3617d1 100644 --- a/src/opt/sfm/sfmWin.c +++ b/src/opt/sfm/sfmWin.c @@ -264,7 +264,7 @@ int Sfm_NtkCollectTfi_rec( Sfm_Ntk_t * p, int iNode, int nWinSizeMax ) int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose ) { int i, k, iTemp, nDivStart; - clock_t clk = clock(); + abctime clk = Abc_Clock(); assert( Sfm_ObjIsNode( p, iNode ) ); Vec_IntClear( p->vLeaves ); // leaves Vec_IntClear( p->vNodes ); // internal @@ -276,7 +276,7 @@ int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose ) if ( Sfm_NtkCollectTfi_rec( p, iNode, p->pPars->nWinSizeMax ) ) { p->nMaxDivs++; - p->timeWin += clock() - clk; + p->timeWin += Abc_Clock() - clk; return 0; } // collect TFO (currently use only one level of TFO) @@ -293,8 +293,8 @@ int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose ) } else Vec_IntPush( p->vRoots, iNode ); - p->timeWin += clock() - clk; - clk = clock(); + p->timeWin += Abc_Clock() - clk; + clk = Abc_Clock(); // create divisors Vec_IntClear( p->vDivs ); Vec_IntForEachEntry( p->vLeaves, iTemp, i ) @@ -338,7 +338,7 @@ int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose ) assert( Vec_IntSize(p->vDivs) <= p->pPars->nWinSizeMax ); // statistics p->nTotalDivs += Vec_IntSize(p->vDivs); - p->timeDiv += clock() - clk; + p->timeDiv += Abc_Clock() - clk; if ( !fVerbose ) return 1; |