summaryrefslogtreecommitdiffstats
path: root/src/opt/cgt
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2013-05-27 15:09:23 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2013-05-27 15:09:23 -0700
commit19c25fd6aab057b2373717f996fe538507c1b1e1 (patch)
tree7aa7cd7609a5de31d11b3455b6388fd9300c8d0f /src/opt/cgt
parent94356f0d1fa8e671303299717f631ecf0ca2f17e (diff)
downloadabc-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/cgt')
-rw-r--r--src/opt/cgt/cgtCore.c16
-rw-r--r--src/opt/cgt/cgtDecide.c8
-rw-r--r--src/opt/cgt/cgtInt.h18
-rw-r--r--src/opt/cgt/cgtSat.c12
4 files changed, 27 insertions, 27 deletions
diff --git a/src/opt/cgt/cgtCore.c b/src/opt/cgt/cgtCore.c
index a24b180b..a7b3844c 100644
--- a/src/opt/cgt/cgtCore.c
+++ b/src/opt/cgt/cgtCore.c
@@ -201,19 +201,19 @@ void Cgt_ClockGatingRangeCheck( Cgt_Man_t * p, int iStart, int nOutputs )
int Cgt_ClockGatingRange( Cgt_Man_t * p, int iStart )
{
int nOutputs, iStop;
- clock_t clk, clkTotal = clock();
+ abctime clk, clkTotal = Abc_Clock();
int nCallsUnsat = p->nCallsUnsat;
int nCallsSat = p->nCallsSat;
int nCallsUndec = p->nCallsUndec;
int nCallsFiltered = p->nCallsFiltered;
-clk = clock();
+clk = Abc_Clock();
p->pPart = Cgt_ManDupPartition( p->pFrame, p->pPars->nVarsMin, p->pPars->nFlopsMin, iStart, p->pCare, p->vSuppsInv, &nOutputs );
p->pCnf = Cnf_DeriveSimple( p->pPart, nOutputs );
p->pSat = (sat_solver *)Cnf_DataWriteIntoSolver( p->pCnf, 1, 0 );
sat_solver_compress( p->pSat );
p->vPatts = Vec_PtrAllocSimInfo( Aig_ManObjNumMax(p->pPart), p->nPattWords );
Vec_PtrCleanSimInfo( p->vPatts, 0, p->nPattWords );
-p->timePrepare += clock() - clk;
+p->timePrepare += Abc_Clock() - clk;
Cgt_ClockGatingRangeCheck( p, iStart, nOutputs );
iStop = iStart + nOutputs;
if ( p->pPars->fVeryVerbose )
@@ -224,7 +224,7 @@ p->timePrepare += clock() - clk;
p->nCallsSat -nCallsSat,
p->nCallsUndec-nCallsUndec,
p->nCallsFiltered-nCallsFiltered );
- ABC_PRT( "Time", clock() - clkTotal );
+ ABC_PRT( "Time", Abc_Clock() - clkTotal );
}
Cgt_ManClean( p );
p->nRecycles++;
@@ -249,14 +249,14 @@ Vec_Vec_t * Cgt_ClockGatingCandidates( Aig_Man_t * pAig, Aig_Man_t * pCare, Cgt_
Cgt_Man_t * p;
Vec_Vec_t * vGatesAll;
int iStart;
- clock_t clk = clock(), clkTotal = clock();
+ abctime clk = Abc_Clock(), clkTotal = Abc_Clock();
// reset random numbers
Aig_ManRandom( 1 );
if ( pPars == NULL )
Cgt_SetDefaultParams( pPars = &Pars );
p = Cgt_ManCreate( pAig, pCare, pPars );
p->pFrame = Cgt_ManDeriveAigForGating( p );
-p->timeAig += clock() - clk;
+p->timeAig += Abc_Clock() - clk;
assert( Aig_ManCoNum(p->pFrame) == Saig_ManRegNum(p->pAig) );
pProgress = Bar_ProgressStart( stdout, Aig_ManCoNum(p->pFrame) );
for ( iStart = 0; iStart < Aig_ManCoNum(p->pFrame); )
@@ -267,7 +267,7 @@ p->timeAig += clock() - clk;
Bar_ProgressStop( pProgress );
vGatesAll = p->vGatesAll;
p->vGatesAll = NULL;
-p->timeTotal = clock() - clkTotal;
+p->timeTotal = Abc_Clock() - clkTotal;
Cgt_ManStop( p );
return vGatesAll;
}
@@ -288,7 +288,7 @@ Aig_Man_t * Cgt_ClockGating( Aig_Man_t * pAig, Aig_Man_t * pCare, Cgt_Par_t * pP
Aig_Man_t * pGated;
Vec_Vec_t * vGatesAll;
Vec_Vec_t * vGates;
- int nNodesUsed;//, clk = clock();
+ int nNodesUsed;//, clk = Abc_Clock();
vGatesAll = Cgt_ClockGatingCandidates( pAig, pCare, pPars );
if ( pPars->fAreaOnly )
vGates = Cgt_ManDecideArea( pAig, vGatesAll, pPars->nOdcMax, pPars->fVerbose );
diff --git a/src/opt/cgt/cgtDecide.c b/src/opt/cgt/cgtDecide.c
index 63730f55..033375a7 100644
--- a/src/opt/cgt/cgtDecide.c
+++ b/src/opt/cgt/cgtDecide.c
@@ -193,7 +193,7 @@ Vec_Vec_t * Cgt_ManDecideSimple( Aig_Man_t * pAig, Vec_Vec_t * vGatesAll, int nO
Vec_Ptr_t * vCands;
Aig_Obj_t * pObjLi, * pObjLo, * pCand, * pCandBest;
int i, k, nHitsCur, nHitsMax, Counter = 0;
- clock_t clk = clock();
+ abctime clk = Abc_Clock();
int nTransTotal = 0, nTransSaved = 0;
vGates = Vec_VecStart( Saig_ManRegNum(pAig) );
pSml = Ssw_SmlSimulateSeq( pAig, 0, nFrames, nWords );
@@ -231,7 +231,7 @@ Vec_Vec_t * Cgt_ManDecideSimple( Aig_Man_t * pAig, Vec_Vec_t * vGatesAll, int nO
// printf( "Gated transitions = %5.2f %%. (%5.2f %%.) ",
// 100.0*nTransSaved/nTransTotal, Cgt_ManComputeCoverage(pAig, vGates) );
printf( "Gated transitions = %5.2f %%. ", Cgt_ManComputeCoverage(pAig, vGates) );
- ABC_PRT( "Time", clock() - clk );
+ ABC_PRT( "Time", Abc_Clock() - clk );
}
/*
{
@@ -261,7 +261,7 @@ Vec_Vec_t * Cgt_ManDecideArea( Aig_Man_t * pAig, Vec_Vec_t * vGatesAll, int nOdc
Vec_Ptr_t * vCompletes, * vOne;
Aig_Obj_t * pGate;
int i, k, Counter = 0;
- clock_t clk = clock();
+ abctime clk = Abc_Clock();
// derive and label complete gates
vCompletes = Cgt_ManCompleteGates( pAig, vGatesAll, nOdcMax, fVerbose );
// label complete gates
@@ -288,7 +288,7 @@ Vec_Vec_t * Cgt_ManDecideArea( Aig_Man_t * pAig, Vec_Vec_t * vGatesAll, int nOdc
Vec_VecSizeSize(vGatesAll), Counter, Saig_ManRegNum(pAig) );
printf( "Complete gates = %6d. Gated transitions = %5.2f %%. ",
Vec_PtrSize(vCompletes), Cgt_ManComputeCoverage(pAig, vGates) );
- ABC_PRT( "Time", clock() - clk );
+ ABC_PRT( "Time", Abc_Clock() - clk );
}
Vec_PtrFree( vCompletes );
return vGates;
diff --git a/src/opt/cgt/cgtInt.h b/src/opt/cgt/cgtInt.h
index b73d60dd..43d38d8d 100644
--- a/src/opt/cgt/cgtInt.h
+++ b/src/opt/cgt/cgtInt.h
@@ -74,15 +74,15 @@ struct Cgt_Man_t_
int nCallsUnsat; // unsatisfiable calls
int nCallsUndec; // undecided calls
int nCallsFiltered; // filtered out calls
- clock_t timeAig; // constructing AIG
- clock_t timePrepare; // partitioning and SAT solving
- clock_t timeSat; // total runtime
- clock_t timeSatSat; // satisfiable runtime
- clock_t timeSatUnsat; // unsatisfiable runtime
- clock_t timeSatUndec; // undecided runtime
- clock_t timeDecision; // making decision about what gates to use
- clock_t timeOther; // other runtime
- clock_t timeTotal; // total runtime
+ abctime timeAig; // constructing AIG
+ abctime timePrepare; // partitioning and SAT solving
+ abctime timeSat; // total runtime
+ abctime timeSatSat; // satisfiable runtime
+ abctime timeSatUnsat; // unsatisfiable runtime
+ abctime timeSatUndec; // undecided runtime
+ abctime timeDecision; // making decision about what gates to use
+ abctime timeOther; // other runtime
+ abctime timeTotal; // total runtime
};
////////////////////////////////////////////////////////////////////////
diff --git a/src/opt/cgt/cgtSat.c b/src/opt/cgt/cgtSat.c
index b6d3c599..9ff5f69c 100644
--- a/src/opt/cgt/cgtSat.c
+++ b/src/opt/cgt/cgtSat.c
@@ -47,7 +47,7 @@ int Cgt_CheckImplication( Cgt_Man_t * p, Aig_Obj_t * pGate, Aig_Obj_t * pMiter )
{
int nBTLimit = p->pPars->nConfMax;
int pLits[2], RetValue;
- clock_t clk;
+ abctime clk;
p->nCalls++;
// sanity checks
@@ -60,12 +60,12 @@ int Cgt_CheckImplication( Cgt_Man_t * p, Aig_Obj_t * pGate, Aig_Obj_t * pMiter )
pLits[0] = toLitCond( p->pCnf->pVarNums[Aig_Regular(pGate)->Id], Aig_IsComplement(pGate) );
pLits[1] = toLitCond( p->pCnf->pVarNums[pMiter->Id], 0 );
-clk = clock();
+clk = Abc_Clock();
RetValue = sat_solver_solve( p->pSat, pLits, pLits + 2, (ABC_INT64_T)nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
-p->timeSat += clock() - clk;
+p->timeSat += Abc_Clock() - clk;
if ( RetValue == l_False )
{
-p->timeSatUnsat += clock() - clk;
+p->timeSatUnsat += Abc_Clock() - clk;
pLits[0] = lit_neg( pLits[0] );
pLits[1] = lit_neg( pLits[1] );
RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 2 );
@@ -76,13 +76,13 @@ p->timeSatUnsat += clock() - clk;
}
else if ( RetValue == l_True )
{
-p->timeSatSat += clock() - clk;
+p->timeSatSat += Abc_Clock() - clk;
p->nCallsSat++;
return 0;
}
else // if ( RetValue1 == l_Undef )
{
-p->timeSatUndec += clock() - clk;
+p->timeSatUndec += Abc_Clock() - clk;
p->nCallsUndec++;
return -1;
}