From 19c25fd6aab057b2373717f996fe538507c1b1e1 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 27 May 2013 15:09:23 -0700 Subject: Adding a wrapper around clock() for more accurate time counting in ABC. --- src/opt/rwt/rwt.h | 22 +++++++++++----------- src/opt/rwt/rwtMan.c | 12 ++++++------ src/opt/rwt/rwtUtil.c | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/opt/rwt') diff --git a/src/opt/rwt/rwt.h b/src/opt/rwt/rwt.h index ff00cf52..2a0f7618 100644 --- a/src/opt/rwt/rwt.h +++ b/src/opt/rwt/rwt.h @@ -94,14 +94,14 @@ struct Rwt_Man_t_ int nCutsBad; int nSubgraphs; // runtime statistics - clock_t timeStart; - clock_t timeTruth; - clock_t timeCut; - clock_t timeRes; - clock_t timeEval; - clock_t timeMffc; - clock_t timeUpdate; - clock_t timeTotal; + abctime timeStart; + abctime timeTruth; + abctime timeCut; + abctime timeRes; + abctime timeEval; + abctime timeMffc; + abctime timeUpdate; + abctime timeTotal; }; struct Rwt_Node_t_ // 24 bytes @@ -142,9 +142,9 @@ extern void Rwt_ManPrintStatsFile( Rwt_Man_t * p ); extern void * Rwt_ManReadDecs( Rwt_Man_t * p ); extern Vec_Ptr_t * Rwt_ManReadLeaves( Rwt_Man_t * p ); extern int Rwt_ManReadCompl( Rwt_Man_t * p ); -extern void Rwt_ManAddTimeCuts( Rwt_Man_t * p, clock_t Time ); -extern void Rwt_ManAddTimeUpdate( Rwt_Man_t * p, clock_t Time ); -extern void Rwt_ManAddTimeTotal( Rwt_Man_t * p, clock_t Time ); +extern void Rwt_ManAddTimeCuts( Rwt_Man_t * p, abctime Time ); +extern void Rwt_ManAddTimeUpdate( Rwt_Man_t * p, abctime Time ); +extern void Rwt_ManAddTimeTotal( Rwt_Man_t * p, abctime Time ); /*=== rwrUtil.c ========================================================*/ extern void Rwt_ManLoadFromArray( Rwt_Man_t * p, int fVerbose ); extern char * Rwt_ManGetPractical( Rwt_Man_t * p ); diff --git a/src/opt/rwt/rwtMan.c b/src/opt/rwt/rwtMan.c index 18998ac8..d7597e08 100644 --- a/src/opt/rwt/rwtMan.c +++ b/src/opt/rwt/rwtMan.c @@ -87,8 +87,8 @@ void Rwt_ManGlobalStop() Rwt_Man_t * Rwt_ManStart( int fPrecompute ) { Rwt_Man_t * p; - clock_t clk = clock(); -clk = clock(); + abctime clk = Abc_Clock(); +clk = Abc_Clock(); p = ABC_ALLOC( Rwt_Man_t, 1 ); memset( p, 0, sizeof(Rwt_Man_t) ); p->nFuncs = (1<<16); @@ -131,7 +131,7 @@ clk = clock(); // Rwt_ManPrint( p ); Rwt_ManPreprocess( p ); } -p->timeStart = clock() - clk; +p->timeStart = Abc_Clock() - clk; return p; } @@ -298,7 +298,7 @@ int Rwt_ManReadCompl( Rwt_Man_t * p ) SeeAlso [] ***********************************************************************/ -void Rwt_ManAddTimeCuts( Rwt_Man_t * p, clock_t Time ) +void Rwt_ManAddTimeCuts( Rwt_Man_t * p, abctime Time ) { p->timeCut += Time; } @@ -314,7 +314,7 @@ void Rwt_ManAddTimeCuts( Rwt_Man_t * p, clock_t Time ) SeeAlso [] ***********************************************************************/ -void Rwt_ManAddTimeUpdate( Rwt_Man_t * p, clock_t Time ) +void Rwt_ManAddTimeUpdate( Rwt_Man_t * p, abctime Time ) { p->timeUpdate += Time; } @@ -330,7 +330,7 @@ void Rwt_ManAddTimeUpdate( Rwt_Man_t * p, clock_t Time ) SeeAlso [] ***********************************************************************/ -void Rwt_ManAddTimeTotal( Rwt_Man_t * p, clock_t Time ) +void Rwt_ManAddTimeTotal( Rwt_Man_t * p, abctime Time ) { p->timeTotal += Time; } diff --git a/src/opt/rwt/rwtUtil.c b/src/opt/rwt/rwtUtil.c index d6011b20..c6bf63ed 100644 --- a/src/opt/rwt/rwtUtil.c +++ b/src/opt/rwt/rwtUtil.c @@ -593,7 +593,7 @@ void Rwt_ManLoadFromArray( Rwt_Man_t * p, int fVerbose ) unsigned Entry0, Entry1; int Level, Volume, nEntries, fExor; int i; - clock_t clk = clock(); + abctime clk = Abc_Clock(); // reconstruct the forest for ( i = 0; ; i++ ) @@ -622,7 +622,7 @@ void Rwt_ManLoadFromArray( Rwt_Man_t * p, int fVerbose ) if ( fVerbose ) { printf( "The number of classes = %d. Canonical nodes = %d.\n", p->nClasses, p->nAdded ); - printf( "The number of nodes loaded = %d. ", nEntries ); ABC_PRT( "Loading", clock() - clk ); + printf( "The number of nodes loaded = %d. ", nEntries ); ABC_PRT( "Loading", Abc_Clock() - clk ); } } -- cgit v1.2.3