summaryrefslogtreecommitdiffstats
path: root/src/opt/csw
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/csw
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/csw')
-rw-r--r--src/opt/csw/cswCore.c6
-rw-r--r--src/opt/csw/cswCut.c14
-rw-r--r--src/opt/csw/cswInt.h8
3 files changed, 14 insertions, 14 deletions
diff --git a/src/opt/csw/cswCore.c b/src/opt/csw/cswCore.c
index 3702b346..d1b871f9 100644
--- a/src/opt/csw/cswCore.c
+++ b/src/opt/csw/cswCore.c
@@ -48,8 +48,8 @@ Aig_Man_t * Csw_Sweep( Aig_Man_t * pAig, int nCutsMax, int nLeafMax, int fVerbos
Aig_Man_t * pRes;
Aig_Obj_t * pObj, * pObjNew, * pObjRes;
int i;
- clock_t clk;
-clk = clock();
+ abctime clk;
+clk = Abc_Clock();
// start the manager
p = Csw_ManStart( pAig, nCutsMax, nLeafMax, fVerbose );
// set elementary cuts at the PIs
@@ -83,7 +83,7 @@ clk = clock();
// remove dangling nodes
Aig_ManCleanup( p->pManRes );
// return the resulting manager
-p->timeTotal = clock() - clk;
+p->timeTotal = Abc_Clock() - clk;
p->timeOther = p->timeTotal - p->timeCuts - p->timeHash;
pRes = p->pManRes;
Csw_ManStop( p );
diff --git a/src/opt/csw/cswCut.c b/src/opt/csw/cswCut.c
index 0b1d9254..0474d8a5 100644
--- a/src/opt/csw/cswCut.c
+++ b/src/opt/csw/cswCut.c
@@ -498,7 +498,7 @@ Aig_Obj_t * Csw_ObjSweep( Csw_Man_t * p, Aig_Obj_t * pObj, int fTriv )
Aig_Obj_t * pObjNew;
unsigned * pTruth;
int i, k, nVars, nFanins, iVar;
- clock_t clk;
+ abctime clk;
assert( !Aig_IsComplement(pObj) );
if ( !Aig_ObjIsNode(pObj) )
@@ -523,7 +523,7 @@ Aig_Obj_t * Csw_ObjSweep( Csw_Man_t * p, Aig_Obj_t * pObj, int fTriv )
continue;
// get the next cut of this node
pCut = Csw_CutFindFree( p, pObj );
-clk = clock();
+clk = Abc_Clock();
// assemble the new cut
if ( !Csw_CutMerge( p, pCut0, pCut1, pCut ) )
{
@@ -542,7 +542,7 @@ clk = clock();
nFanins = pCut->nFanins;
// nVars = Csw_CutSupportMinimize( p, pCut ); // leads to quality degradation
nVars = Kit_TruthSupportSize( pTruth, p->nLeafMax );
-p->timeCuts += clock() - clk;
+p->timeCuts += Abc_Clock() - clk;
// check for trivial truth tables
if ( nVars == 0 )
@@ -567,9 +567,9 @@ p->timeCuts += clock() - clk;
}
// check if an equivalent node with the same cut exists
-clk = clock();
+clk = Abc_Clock();
pObjNew = pCut->nFanins > 2 ? Csw_TableCutLookup( p, pCut ) : NULL;
-p->timeHash += clock() - clk;
+p->timeHash += Abc_Clock() - clk;
if ( pObjNew )
{
p->nNodesCuts++;
@@ -584,7 +584,7 @@ p->timeHash += clock() - clk;
p->nNodesTried++;
// load the resulting cuts into the table
-clk = clock();
+clk = Abc_Clock();
Csw_ObjForEachCut( p, pObj, pCut, i )
{
if ( pCut->nFanins > 2 )
@@ -593,7 +593,7 @@ clk = clock();
Csw_TableCutInsert( p, pCut );
}
}
-p->timeHash += clock() - clk;
+p->timeHash += Abc_Clock() - clk;
// return the node if could not replace it
return pObj;
diff --git a/src/opt/csw/cswInt.h b/src/opt/csw/cswInt.h
index 4f8dac39..890a61d2 100644
--- a/src/opt/csw/cswInt.h
+++ b/src/opt/csw/cswInt.h
@@ -93,10 +93,10 @@ struct Csw_Man_t_
int nNodesTriv2; // the number of trivial nodes
int nNodesCuts; // the number of rewritten nodes
int nNodesTried; // the number of nodes tried
- clock_t timeCuts; // time to compute the cut and its truth table
- clock_t timeHash; // time for hashing cuts
- clock_t timeOther; // other time
- clock_t timeTotal; // total time
+ abctime timeCuts; // time to compute the cut and its truth table
+ abctime timeHash; // time for hashing cuts
+ abctime timeOther; // other time
+ abctime timeTotal; // total time
};
static inline int Csw_CutLeaveNum( Csw_Cut_t * pCut ) { return pCut->nFanins; }