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/bdd/cas | |
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/bdd/cas')
-rw-r--r-- | src/bdd/cas/casCore.c | 48 | ||||
-rw-r--r-- | src/bdd/cas/casDec.c | 16 |
2 files changed, 32 insertions, 32 deletions
diff --git a/src/bdd/cas/casCore.c b/src/bdd/cas/casCore.c index 35b1145c..b2e06805 100644 --- a/src/bdd/cas/casCore.c +++ b/src/bdd/cas/casCore.c @@ -81,7 +81,7 @@ int Abc_CascadeExperiment( char * pFileGeneric, DdManager * dd, DdNode ** pOutpu int i; int nVars = nInputs; int nOuts = nOutputs; - clock_t clk1; + abctime clk1; int nVarsEnc; // the number of additional variables to encode outputs DdNode * pbVarsEnc[MAXOUTPUTS]; // the BDDs of the encoding vars @@ -140,11 +140,11 @@ int Abc_CascadeExperiment( char * pFileGeneric, DdManager * dd, DdNode ** pOutpu // printf( "\n" ); // derive the single-output function - clk1 = clock(); + clk1 = Abc_Clock(); aFunc = GetSingleOutputFunction( dd, pOutputs, nOuts, pbVarsEnc, nVarsEnc, fVerbose ); Cudd_Ref( aFunc ); // aFunc = GetSingleOutputFunctionRemapped( dd, pOutputs, nOuts, pbVarsEnc, nVarsEnc ); Cudd_Ref( aFunc ); // if ( fVerbose ) -// printf( "Single-output function computation time = %.2f sec\n", (float)(clock() - clk1)/(float)(CLOCKS_PER_SEC) ); +// printf( "Single-output function computation time = %.2f sec\n", (float)(Abc_Clock() - clk1)/(float)(CLOCKS_PER_SEC) ); //fprintf( pTable, "%d ", Cudd_SharingSize( pOutputs, nOutputs ) ); //fprintf( pTable, "%d ", Extra_ProfileWidthSharingMax(dd, pOutputs, nOutputs) ); @@ -155,7 +155,7 @@ int Abc_CascadeExperiment( char * pFileGeneric, DdManager * dd, DdNode ** pOutpu // reorder the single output function // if ( fVerbose ) // printf( "Reordering variables...\n"); - clk1 = clock(); + clk1 = Abc_Clock(); // if ( fVerbose ) // printf( "Node count before = %6d\n", Cudd_DagSize( aFunc ) ); // Cudd_ReduceHeap(dd, CUDD_REORDER_SIFT,1); @@ -168,7 +168,7 @@ int Abc_CascadeExperiment( char * pFileGeneric, DdManager * dd, DdNode ** pOutpu if ( fVerbose ) printf( "MTBDD reordered = %6d nodes\n", Cudd_DagSize( aFunc ) ); if ( fVerbose ) - printf( "Variable reordering time = %.2f sec\n", (float)(clock() - clk1)/(float)(CLOCKS_PER_SEC) ); + printf( "Variable reordering time = %.2f sec\n", (float)(Abc_Clock() - clk1)/(float)(CLOCKS_PER_SEC) ); // printf( "\n" ); // printf( "Variable order is: " ); // for ( i = 0; i < dd->size; i++ ) @@ -178,16 +178,16 @@ int Abc_CascadeExperiment( char * pFileGeneric, DdManager * dd, DdNode ** pOutpu //fprintf( pTable, "%d ", Extra_ProfileWidthMax(dd, aFunc) ); // write the single-output function into BLIF for verification - clk1 = clock(); + clk1 = Abc_Clock(); if ( fCheck ) WriteSingleOutputFunctionBlif( dd, aFunc, pNames, nNames, FileNameIni ); // if ( fVerbose ) -// printf( "Single-output function writing time = %.2f sec\n", (float)(clock() - clk1)/(float)(CLOCKS_PER_SEC) ); +// printf( "Single-output function writing time = %.2f sec\n", (float)(Abc_Clock() - clk1)/(float)(CLOCKS_PER_SEC) ); /* /////////////////////////////////////////////////////////////////// // verification of single output function - clk1 = clock(); + clk1 = Abc_Clock(); { BFunc g_Func; DdNode * aRes; @@ -214,7 +214,7 @@ int Abc_CascadeExperiment( char * pFileGeneric, DdManager * dd, DdNode ** pOutpu // delocate Extra_Dissolve( &g_Func ); } - printf( "Preliminary verification time = %.2f sec\n", (float)(clock() - clk1)/(float)(CLOCKS_PER_SEC) ); + printf( "Preliminary verification time = %.2f sec\n", (float)(Abc_Clock() - clk1)/(float)(CLOCKS_PER_SEC) ); /////////////////////////////////////////////////////////////////// */ @@ -224,7 +224,7 @@ int Abc_CascadeExperiment( char * pFileGeneric, DdManager * dd, DdNode ** pOutpu /* /////////////////////////////////////////////////////////////////// // verification of the decomposed LUT network - clk1 = clock(); + clk1 = Abc_Clock(); { BFunc g_Func; DdNode * aRes; @@ -251,7 +251,7 @@ int Abc_CascadeExperiment( char * pFileGeneric, DdManager * dd, DdNode ** pOutpu // delocate Extra_Dissolve( &g_Func ); } - printf( "Final verification time = %.2f sec\n", (float)(clock() - clk1)/(float)(CLOCKS_PER_SEC) ); + printf( "Final verification time = %.2f sec\n", (float)(Abc_Clock() - clk1)/(float)(CLOCKS_PER_SEC) ); /////////////////////////////////////////////////////////////////// */ @@ -325,24 +325,24 @@ void Experiment2( BFunc * pFunc ) strcat( FileNameFin, "_LUT.blif" ); // derive the single-output function IN THE NEW MANAGER - clk1 = clock(); + clk1 = Abc_Clock(); // aFunc = GetSingleOutputFunction( dd, pFunc->pOutputs, nOuts, pbVarsEnc, nVarsEnc ); Cudd_Ref( aFunc ); aFunc = GetSingleOutputFunctionRemappedNewDD( dd, pFunc->pOutputs, nOuts, &DdNew ); Cudd_Ref( aFunc ); - printf( "Single-output function derivation time = %.2f sec\n", (float)(clock() - clk1)/(float)(CLOCKS_PER_SEC) ); -// s_RemappingTime = clock() - clk1; + printf( "Single-output function derivation time = %.2f sec\n", (float)(Abc_Clock() - clk1)/(float)(CLOCKS_PER_SEC) ); +// s_RemappingTime = Abc_Clock() - clk1; // dispose of the multiple-output function Extra_Dissolve( pFunc ); // reorder the single output function printf( "\nReordering variables in the new manager...\n"); - clk1 = clock(); + clk1 = Abc_Clock(); printf( "Node count before = %d\n", Cudd_DagSize( aFunc ) ); // Cudd_ReduceHeap(DdNew, CUDD_REORDER_SIFT,1); Cudd_ReduceHeap(DdNew, CUDD_REORDER_SYMM_SIFT,1); // Cudd_ReduceHeap(DdNew, CUDD_REORDER_SYMM_SIFT,1); printf( "Node count after = %d\n", Cudd_DagSize( aFunc ) ); - printf( "Variable reordering time = %.2f sec\n", (float)(clock() - clk1)/(float)(CLOCKS_PER_SEC) ); + printf( "Variable reordering time = %.2f sec\n", (float)(Abc_Clock() - clk1)/(float)(CLOCKS_PER_SEC) ); printf( "\n" ); //fprintf( pTable, "%d ", Cudd_DagSize( aFunc ) ); @@ -360,14 +360,14 @@ void Experiment2( BFunc * pFunc ) // write the single-output function into BLIF for verification - clk1 = clock(); + clk1 = Abc_Clock(); WriteSingleOutputFunctionBlif( DdNew, aFunc, pNames, nNames, FileNameIni ); - printf( "Single-output function writing time = %.2f sec\n", (float)(clock() - clk1)/(float)(CLOCKS_PER_SEC) ); + printf( "Single-output function writing time = %.2f sec\n", (float)(Abc_Clock() - clk1)/(float)(CLOCKS_PER_SEC) ); /////////////////////////////////////////////////////////////////// // verification of single output function - clk1 = clock(); + clk1 = Abc_Clock(); { BFunc g_Func; DdNode * aRes; @@ -394,7 +394,7 @@ void Experiment2( BFunc * pFunc ) // delocate Extra_Dissolve( &g_Func ); } - printf( "Preliminary verification time = %.2f sec\n", (float)(clock() - clk1)/(float)(CLOCKS_PER_SEC) ); + printf( "Preliminary verification time = %.2f sec\n", (float)(Abc_Clock() - clk1)/(float)(CLOCKS_PER_SEC) ); /////////////////////////////////////////////////////////////////// @@ -403,7 +403,7 @@ void Experiment2( BFunc * pFunc ) /* /////////////////////////////////////////////////////////////////// // verification of the decomposed LUT network - clk1 = clock(); + clk1 = Abc_Clock(); { BFunc g_Func; DdNode * aRes; @@ -430,7 +430,7 @@ void Experiment2( BFunc * pFunc ) // delocate Extra_Dissolve( &g_Func ); } - printf( "Final verification time = %.2f sec\n", (float)(clock() - clk1)/(float)(CLOCKS_PER_SEC) ); + printf( "Final verification time = %.2f sec\n", (float)(Abc_Clock() - clk1)/(float)(CLOCKS_PER_SEC) ); /////////////////////////////////////////////////////////////////// */ @@ -954,12 +954,12 @@ void WriteDDintoBLIFfileReorder( DdManager * dd, FILE * pFile, DdNode * Func, ch /////////////////////////////////////////////////////////////// DdNode * bFmin; - clock_t clk1; + abctime clk1; if ( s_ddmin == NULL ) s_ddmin = Cudd_Init( dd->size, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0); - clk1 = clock(); + clk1 = Abc_Clock(); bFmin = Cudd_bddTransfer( dd, s_ddmin, Func ); Cudd_Ref( bFmin ); // reorder diff --git a/src/bdd/cas/casDec.c b/src/bdd/cas/casDec.c index 06ce04ea..82c23240 100644 --- a/src/bdd/cas/casDec.c +++ b/src/bdd/cas/casDec.c @@ -128,14 +128,14 @@ int CreateDecomposedNetwork( DdManager * dd, DdNode * aFunc, char ** pNames, int int nLutOutputs = 0; int nLutOutputsOrig = 0; - clock_t clk1; + abctime clk1; s_LutSize = nLutSize; s_nFuncVars = nNames; // get the profile - clk1 = clock(); + clk1 = Abc_Clock(); Extra_ProfileWidth( dd, aFunc, Profile, -1 ); @@ -284,10 +284,10 @@ int CreateDecomposedNetwork( DdManager * dd, DdNode * aFunc, char ** pNames, int } else { - clock_t clk2 = clock(); + abctime clk2 = Abc_Clock(); // p->bRelation = PerformTheEncoding( dd, p->pbCols, p->nCols, bVarsCube, bCVars, p->nMulti, &p->nSimple ); Cudd_Ref( p->bRelation ); p->bRelation = Extra_bddEncodingNonStrict( dd, p->pbCols, p->nCols, bVarsCube, bCVars, p->nMulti, &p->nSimple ); Cudd_Ref( p->bRelation ); - s_EncodingTime += clock() - clk2; + s_EncodingTime += Abc_Clock() - clk2; } // update the number of LUT outputs @@ -353,7 +353,7 @@ printf( "Stage %3d: In = %3d InP = %3d Cols = %5d Multi = %2d Simple = %2d if ( fVerbose ) { - printf( "Pure decomposition time = %.2f sec\n", (float)(clock() - clk1 - s_EncodingTime)/(float)(CLOCKS_PER_SEC) ); + printf( "Pure decomposition time = %.2f sec\n", (float)(Abc_Clock() - clk1 - s_EncodingTime)/(float)(CLOCKS_PER_SEC) ); printf( "Encoding time = %.2f sec\n", (float)(s_EncodingTime)/(float)(CLOCKS_PER_SEC) ); // printf( "Encoding search time = %.2f sec\n", (float)(s_EncSearchTime)/(float)(CLOCKS_PER_SEC) ); // printf( "Encoding compute time = %.2f sec\n", (float)(s_EncComputeTime)/(float)(CLOCKS_PER_SEC) ); @@ -361,13 +361,13 @@ printf( "Stage %3d: In = %3d InP = %3d Cols = %5d Multi = %2d Simple = %2d //fprintf( pTable, "%.2f ", (float)(s_ReadingTime)/(float)(CLOCKS_PER_SEC) ); -//fprintf( pTable, "%.2f ", (float)(clock() - clk1 - s_EncodingTime)/(float)(CLOCKS_PER_SEC) ); +//fprintf( pTable, "%.2f ", (float)(Abc_Clock() - clk1 - s_EncodingTime)/(float)(CLOCKS_PER_SEC) ); //fprintf( pTable, "%.2f ", (float)(s_EncodingTime)/(float)(CLOCKS_PER_SEC) ); //fprintf( pTable, "%.2f ", (float)(s_RemappingTime)/(float)(CLOCKS_PER_SEC) ); // write LUTs into the BLIF file - clk1 = clock(); + clk1 = Abc_Clock(); if ( fCheck ) { FILE * pFile; @@ -388,7 +388,7 @@ printf( "Stage %3d: In = %3d InP = %3d Cols = %5d Multi = %2d Simple = %2d fprintf( pFile, ".end\n" ); fclose( pFile ); if ( fVerbose ) - printf( "Output file writing time = %.2f sec\n", (float)(clock() - clk1)/(float)(CLOCKS_PER_SEC) ); + printf( "Output file writing time = %.2f sec\n", (float)(Abc_Clock() - clk1)/(float)(CLOCKS_PER_SEC) ); } |