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/dar | |
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/dar')
-rw-r--r-- | src/opt/dar/darCore.c | 14 | ||||
-rw-r--r-- | src/opt/dar/darInt.h | 12 | ||||
-rw-r--r-- | src/opt/dar/darLib.c | 16 | ||||
-rw-r--r-- | src/opt/dar/darRefact.c | 24 | ||||
-rw-r--r-- | src/opt/dar/darScript.c | 34 |
5 files changed, 50 insertions, 50 deletions
diff --git a/src/opt/dar/darCore.c b/src/opt/dar/darCore.c index bbcb385e..17074123 100644 --- a/src/opt/dar/darCore.c +++ b/src/opt/dar/darCore.c @@ -83,7 +83,7 @@ int Dar_ManRewrite( Aig_Man_t * pAig, Dar_RwrPar_t * pPars ) Dar_Cut_t * pCut; Aig_Obj_t * pObj, * pObjNew; int i, k, nNodesOld, nNodeBefore, nNodeAfter, Required; - clock_t clk = 0, clkStart; + abctime clk = 0, clkStart; int Counter = 0; int nMffcSize;//, nMffcGains[MAX_VAL+1][MAX_VAL+1] = {{0}}; // prepare the library @@ -102,7 +102,7 @@ int Dar_ManRewrite( Aig_Man_t * pAig, Dar_RwrPar_t * pPars ) // set elementary cuts for the PIs // Dar_ManCutsStart( p ); // resynthesize each node once - clkStart = clock(); + clkStart = Abc_Clock(); p->nNodesInit = Aig_ManNodeNum(pAig); nNodesOld = Vec_PtrSize( pAig->vObjs ); @@ -133,10 +133,10 @@ int Dar_ManRewrite( Aig_Man_t * pAig, Dar_RwrPar_t * pPars ) // compute cuts for the node p->nNodesTried++; -clk = clock(); +clk = Abc_Clock(); Dar_ObjSetCuts( pObj, NULL ); Dar_ObjComputeCuts_rec( p, pObj ); -p->timeCuts += clock() - clk; +p->timeCuts += Abc_Clock() - clk; // check if there is a trivial cut Dar_ObjForEachCut( pObj, pCut, k ) @@ -210,7 +210,7 @@ p->timeCuts += clock() - clk; } */ -p->timeTotal = clock() - clkStart; +p->timeTotal = Abc_Clock() - clkStart; p->timeOther = p->timeTotal - p->timeCuts - p->timeEval; // Bar_ProgressStop( pProgress ); @@ -289,7 +289,7 @@ Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig, int nCutsMax, int fSkipTtM Aig_Obj_t * pObj; Aig_MmFixed_t * pMemCuts; int i, nNodes; - clock_t clk = clock(); + abctime clk = Abc_Clock(); // remove dangling nodes if ( (nNodes = Aig_ManCleanup( pAig )) ) { @@ -319,7 +319,7 @@ Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig, int nCutsMax, int fSkipTtM Aig_ManObjNum(pAig), nCuts, nCutsK ); printf( "Cut size = %2d. Truth size = %2d. Total mem = %5.2f MB ", (int)sizeof(Dar_Cut_t), (int)4, 1.0*Aig_MmFixedReadMemUsage(p->pMemCuts)/(1<<20) ); - ABC_PRT( "Runtime", clock() - clk ); + ABC_PRT( "Runtime", Abc_Clock() - clk ); /* Aig_ManForEachNode( pAig, pObj, i ) if ( i % 300 == 0 ) diff --git a/src/opt/dar/darInt.h b/src/opt/dar/darInt.h index 08a905a8..263e66b6 100644 --- a/src/opt/dar/darInt.h +++ b/src/opt/dar/darInt.h @@ -96,12 +96,12 @@ struct Dar_Man_t_ int nCutsGood; // good cuts int nCutsSkipped; // skipped bad cuts // timing statistics - clock_t timeCuts; - clock_t timeEval; - clock_t timeOther; - clock_t timeTotal; - clock_t time1; - clock_t time2; + abctime timeCuts; + abctime timeEval; + abctime timeOther; + abctime timeTotal; + abctime time1; + abctime time2; }; static inline Dar_Cut_t * Dar_ObjCuts( Aig_Obj_t * pObj ) { return (Dar_Cut_t *)pObj->pData; } diff --git a/src/opt/dar/darLib.c b/src/opt/dar/darLib.c index 27408328..ee440872 100644 --- a/src/opt/dar/darLib.c +++ b/src/opt/dar/darLib.c @@ -129,7 +129,7 @@ Dar_Lib_t * Dar_LibAlloc( int nObjs ) { unsigned uTruths[4] = { 0xAAAA, 0xCCCC, 0xF0F0, 0xFF00 }; Dar_Lib_t * p; - int i;//, clk = clock(); + int i;//, clk = Abc_Clock(); p = ABC_ALLOC( Dar_Lib_t, 1 ); memset( p, 0, sizeof(Dar_Lib_t) ); // allocate objects @@ -146,7 +146,7 @@ Dar_Lib_t * Dar_LibAlloc( int nObjs ) p->pObjs[i].fTerm = 1; p->pObjs[i].Num = uTruths[i]; } -// ABC_PRT( "Library start", clock() - clk ); +// ABC_PRT( "Library start", Abc_Clock() - clk ); return p; } @@ -592,11 +592,11 @@ Dar_Lib_t * Dar_LibRead() ***********************************************************************/ void Dar_LibStart() { -// clock_t clk = clock(); +// abctime clk = Abc_Clock(); assert( s_DarLib == NULL ); s_DarLib = Dar_LibRead(); // printf( "The 4-input library started with %d nodes and %d subgraphs. ", s_DarLib->nObjs - 4, s_DarLib->nSubgrTotal ); -// ABC_PRT( "Time", clock() - clk ); +// ABC_PRT( "Time", Abc_Clock() - clk ); } /**Function************************************************************* @@ -921,7 +921,7 @@ void Dar_LibEval( Dar_Man_t * p, Aig_Obj_t * pRoot, Dar_Cut_t * pCut, int Requir float PowerSaved, PowerAdded; Dar_LibObj_t * pObj; int Out, k, Class, nNodesSaved, nNodesAdded, nNodesGained; - clock_t clk = clock(); + abctime clk = Abc_Clock(); if ( pCut->nLeaves != 4 ) return; // check if the cut exits and assigns leaves and their levels @@ -963,7 +963,7 @@ void Dar_LibEval( Dar_Man_t * p, Aig_Obj_t * pRoot, Dar_Cut_t * pCut, int Requir assert( p->LevelBest <= Required ); *pnMffcSize = nNodesSaved; } -clk = clock() - clk; +clk = Abc_Clock() - clk; p->ClassTimes[Class] += clk; p->timeEval += clk; } @@ -1189,7 +1189,7 @@ int Dar2_LibEval( Gia_Man_t * p, Vec_Int_t * vCutLits, unsigned uTruth, int fKee // int fTraining = 0; Dar_LibObj_t * pObj; int Out, k, Class, nNodesSaved, nNodesAdded, nNodesGained; -// clock_t clk = clock(); +// abctime clk = Abc_Clock(); assert( Vec_IntSize(vCutLits) == 4 ); assert( (uTruth >> 16) == 0 ); // check if the cut exits and assigns leaves and their levels @@ -1233,7 +1233,7 @@ int Dar2_LibEval( Gia_Man_t * p, Vec_Int_t * vCutLits, unsigned uTruth, int fKee p_ClassBest = Class; // assert( p_LevelBest <= Required ); } -//clk = clock() - clk; +//clk = Abc_Clock() - clk; //p->ClassTimes[Class] += clk; //p->timeEval += clk; assert( p_OutBest != -1 ); diff --git a/src/opt/dar/darRefact.c b/src/opt/dar/darRefact.c index 0dcb54e8..45e150c4 100644 --- a/src/opt/dar/darRefact.c +++ b/src/opt/dar/darRefact.c @@ -61,10 +61,10 @@ struct Ref_Man_t_ int nCutsUsed; // the number of rewriting steps int nCutsTried; // the number of cuts tries // timing statistics - clock_t timeCuts; - clock_t timeEval; - clock_t timeOther; - clock_t timeTotal; + abctime timeCuts; + abctime timeEval; + abctime timeOther; + abctime timeTotal; }; //////////////////////////////////////////////////////////////////////// @@ -501,7 +501,7 @@ int Dar_ManRefactor( Aig_Man_t * pAig, Dar_RefPar_t * pPars ) Aig_Obj_t * pObj, * pObjNew; int nNodesOld, nNodeBefore, nNodeAfter, nNodesSaved, nNodesSaved2; int i, Required, nLevelMin; - clock_t clkStart, clk; + abctime clkStart, clk; // start the manager p = Dar_ManRefStart( pAig, pPars ); @@ -513,7 +513,7 @@ int Dar_ManRefactor( Aig_Man_t * pAig, Dar_RefPar_t * pPars ) Aig_ManStartReverseLevels( pAig, 0 ); // resynthesize each node once - clkStart = clock(); + clkStart = Abc_Clock(); vCut = Vec_VecEntry( p->vCuts, 0 ); vCut2 = Vec_VecEntry( p->vCuts, 1 ); p->nNodesInit = Aig_ManNodeNum(pAig); @@ -530,12 +530,12 @@ int Dar_ManRefactor( Aig_Man_t * pAig, Dar_RefPar_t * pPars ) //printf( "\nConsidering node %d.\n", pObj->Id ); // get the bounded MFFC size -clk = clock(); +clk = Abc_Clock(); nLevelMin = Abc_MaxInt( 0, Aig_ObjLevel(pObj) - 10 ); nNodesSaved = Aig_NodeMffcSupp( pAig, pObj, nLevelMin, vCut ); if ( nNodesSaved < p->pPars->nMffcMin ) // too small to consider { -p->timeCuts += clock() - clk; +p->timeCuts += Abc_Clock() - clk; continue; } p->nNodesTried++; @@ -564,13 +564,13 @@ p->timeCuts += clock() - clk; else p->nNodesBelow++; } -p->timeCuts += clock() - clk; +p->timeCuts += Abc_Clock() - clk; // try the cuts -clk = clock(); +clk = Abc_Clock(); Required = pAig->vLevelR? Aig_ObjRequiredLevel(pAig, pObj) : ABC_INFINITY; Dar_ManRefactorTryCuts( p, pObj, nNodesSaved, Required ); -p->timeEval += clock() - clk; +p->timeEval += Abc_Clock() - clk; // check the best gain if ( !(p->GainBest > 0 || (p->GainBest == 0 && p->pPars->fUseZeros)) ) @@ -594,7 +594,7 @@ p->timeEval += clock() - clk; p->nCutsUsed++; // break; } -p->timeTotal = clock() - clkStart; +p->timeTotal = Abc_Clock() - clkStart; p->timeOther = p->timeTotal - p->timeCuts - p->timeEval; // Bar_ProgressStop( pProgress ); diff --git a/src/opt/dar/darScript.c b/src/opt/dar/darScript.c index 583ca563..f1a30a82 100644 --- a/src/opt/dar/darScript.c +++ b/src/opt/dar/darScript.c @@ -364,9 +364,9 @@ Aig_Man_t * Dar_ManChoice( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int Aig_Man_t * pMan, * pTemp; Vec_Ptr_t * vAigs; int i; - clock_t clk; + abctime clk; -clk = clock(); +clk = Abc_Clock(); // vAigs = Dar_ManChoiceSynthesisExt(); vAigs = Dar_ManChoiceSynthesis( pAig, fBalance, fUpdateLevel, 0, fVerbose ); @@ -382,9 +382,9 @@ clk = clock(); if ( fVerbose ) { -ABC_PRT( "Synthesis time", clock() - clk ); +ABC_PRT( "Synthesis time", Abc_Clock() - clk ); } -clk = clock(); +clk = Abc_Clock(); if ( fConstruct ) pMan = Aig_ManChoiceConstructive( vAigs, fVerbose ); else @@ -394,7 +394,7 @@ clk = clock(); Vec_PtrFree( vAigs ); if ( fVerbose ) { -ABC_PRT( "Choicing time ", clock() - clk ); +ABC_PRT( "Choicing time ", Abc_Clock() - clk ); } return pMan; // return NULL; @@ -687,9 +687,9 @@ Aig_Man_t * Dar_ManChoiceNew( Aig_Man_t * pAig, Dch_Pars_t * pPars ) Aig_Man_t * pMan, * pTemp; Vec_Ptr_t * vAigs; int i; - clock_t clk; + abctime clk; -clk = clock(); +clk = Abc_Clock(); // vAigs = Dar_ManChoiceSynthesisExt(); // vAigs = Dar_ManChoiceSynthesis( pAig, 1, 1, pPars->fPower, fVerbose ); vAigs = Dar_ManChoiceSynthesis( pAig, 1, 1, pPars->fPower, 0 ); @@ -706,11 +706,11 @@ clk = clock(); if ( fVerbose ) { -//ABC_PRT( "Synthesis time", clock() - clk ); +//ABC_PRT( "Synthesis time", Abc_Clock() - clk ); } - pPars->timeSynth = clock() - clk; + pPars->timeSynth = Abc_Clock() - clk; -clk = clock(); +clk = Abc_Clock(); // perform choice computation if ( pPars->fUseGia ) pMan = Cec_ComputeChoices( vAigs, pPars ); @@ -741,7 +741,7 @@ clk = clock(); if ( fVerbose ) { -//ABC_PRT( "Choicing time ", clock() - clk ); +//ABC_PRT( "Choicing time ", Abc_Clock() - clk ); } return pMan; // return NULL; @@ -770,11 +770,11 @@ Aig_Man_t * Dar_ManChoiceNewAig( Aig_Man_t * pAig, Dch_Pars_t * pPars ) void * pManTime; char * pName, * pSpec; int i; - clock_t clk; + abctime clk; -clk = clock(); +clk = Abc_Clock(); vAigs = Dar_ManChoiceSynthesis( pAig, 1, 1, pPars->fPower, fVerbose ); -pPars->timeSynth = clock() - clk; +pPars->timeSynth = Abc_Clock() - clk; // swap the first and last network // this should lead to the primary choice being "better" because of synthesis // (it is also important when constructing choices) @@ -841,7 +841,7 @@ Aig_Man_t * Dar_ManChoiceNew( Aig_Man_t * pAig, Dch_Pars_t * pPars ) Vec_Ptr_t * vPios; void * pManTime; char * pName, * pSpec; - clock_t clk; + abctime clk; // save useful things pManTime = pAig->pManTime; pAig->pManTime = NULL; @@ -849,9 +849,9 @@ Aig_Man_t * Dar_ManChoiceNew( Aig_Man_t * pAig, Dch_Pars_t * pPars ) pSpec = Abc_UtilStrsav( pAig->pSpec ); // perform synthesis -clk = clock(); +clk = Abc_Clock(); pGia = Dar_NewChoiceSynthesis( Aig_ManDupDfs(pAig), 1, 1, pPars->fPower, pPars->fLightSynth, pPars->fVerbose ); -pPars->timeSynth = clock() - clk; +pPars->timeSynth = Abc_Clock() - clk; // perform choice computation if ( pPars->fUseGia ) |