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/misc/util/abc_global.h | |
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/misc/util/abc_global.h')
-rw-r--r-- | src/misc/util/abc_global.h | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/src/misc/util/abc_global.h b/src/misc/util/abc_global.h index 914fd327..f824ea43 100644 --- a/src/misc/util/abc_global.h +++ b/src/misc/util/abc_global.h @@ -266,25 +266,43 @@ static inline int Abc_LitRegular( int Lit ) { return Lit & ~01 static inline int Abc_Lit2LitV( int * pMap, int Lit ) { return Abc_Var2Lit( pMap[Abc_Lit2Var(Lit)], Abc_LitIsCompl(Lit) ); } static inline int Abc_Lit2LitL( int * pMap, int Lit ) { return Abc_LitNotCond( pMap[Abc_Lit2Var(Lit)], Abc_LitIsCompl(Lit) ); } -enum Abc_VerbLevel + +// time counting +typedef ABC_UINT64_T abctime; +static inline abctime Abc_Clock() { - ABC_PROMPT = -2, - ABC_ERROR = -1, - ABC_WARNING = 0, - ABC_STANDARD = 1, - ABC_VERBOSE = 2 -}; + static abctime PeriodNum = 0; + static clock_t Period = ((abctime)1 << 30); + clock_t ClockTime = clock(); + if ( ClockTime >= Period ) + { + ClockTime -= Period; + PeriodNum++; + } + return PeriodNum * Period + ClockTime; +} + +// bridge communication #define BRIDGE_NETLIST 106 #define BRIDGE_ABS_NETLIST 107 +extern int Gia_ManToBridgeText( FILE * pFile, int Size, unsigned char * pBuffer ); +extern int Gia_ManToBridgeAbsNetlist( FILE * pFile, void * p, int pkg_type ); // string printing extern char * vnsprintf(const char* format, va_list args); extern char * nsprintf(const char* format, ...); -extern int Gia_ManToBridgeText( FILE * pFile, int Size, unsigned char * pBuffer ); -extern int Gia_ManToBridgeAbsNetlist( FILE * pFile, void * p, int pkg_type ); + // misc printing procedures +enum Abc_VerbLevel +{ + ABC_PROMPT = -2, + ABC_ERROR = -1, + ABC_WARNING = 0, + ABC_STANDARD = 1, + ABC_VERBOSE = 2 +}; static inline void Abc_Print( int level, const char * format, ... ) { extern ABC_DLL int Abc_FrameIsBridgeMode(); @@ -339,12 +357,12 @@ static inline void Abc_PrintInt( int i ) Abc_Print( 1, "%4.0fm", v6 ); } -static inline void Abc_PrintTime( int level, const char * pStr, clock_t time ) +static inline void Abc_PrintTime( int level, const char * pStr, abctime time ) { ABC_PRT( pStr, time ); } -static inline void Abc_PrintTimeP( int level, const char * pStr, clock_t time, clock_t Time ) +static inline void Abc_PrintTimeP( int level, const char * pStr, abctime time, abctime Time ) { ABC_PRTP( pStr, time, Time ); } @@ -381,6 +399,7 @@ static inline int Abc_PrimeCudd( unsigned int p ) } // end of Cudd_Prime + // sorting extern void Abc_MergeSort( int * pInput, int nSize ); extern int * Abc_MergeSortCost( int * pCosts, int nSize ); @@ -391,7 +410,6 @@ extern void Abc_QuickSortCostData( int * pCosts, int nSize, int fDecrease, wor extern int * Abc_QuickSortCost( int * pCosts, int nSize, int fDecrease ); - ABC_NAMESPACE_HEADER_END #endif |