Adding color to mapping stats.

This commit is contained in:
Alan Mishchenko 2014-04-19 17:53:40 -07:00
parent 1bca32bae3
commit 472fb39f16
1 changed files with 27 additions and 3 deletions

View File

@ -25,6 +25,10 @@
#include "base/main/main.h"
#include "sat/bsat/satSolver.h"
#ifdef WIN32
#include <windows.h>
#endif
ABC_NAMESPACE_IMPL_START
@ -325,14 +329,34 @@ void Gia_ManPrintMappingStats( Gia_Man_t * p, char * pDumpFile )
Gia_ManForEachCo( p, pObj, i )
Ave += pLevels[Gia_ObjFaninId0p(p, pObj)];
ABC_FREE( pLevels );
#ifdef WIN32
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
Abc_Print( 1, "Mapping (K=%d) : ", nLutSize );
Abc_Print( 1, "lut =%7d ", nLuts );
SetConsoleTextAttribute( hConsole, 14 ); // yellow
Abc_Print( 1, "lut =%7d ", nLuts );
SetConsoleTextAttribute( hConsole, 10 ); // green
Abc_Print( 1, "edge =%8d ", nFanins );
Abc_Print( 1, "lev =%5d ", LevelMax );
Abc_Print( 1, "(%.2f) ", (float)Ave / Gia_ManCoNum(p) );
SetConsoleTextAttribute( hConsole, 11 ); // blue
Abc_Print( 1, "lev =%5d ", LevelMax );
Abc_Print( 1, "(%.2f) ", (float)Ave / Gia_ManCoNum(p) );
SetConsoleTextAttribute( hConsole, 7 ); // normal
Abc_Print( 1, "over =%5.1f %% ", 100.0 * Gia_ManComputeOverlap(p) / Gia_ManAndNum(p) );
Abc_Print( 1, "mem =%5.2f MB", 4.0*(Gia_ManObjNum(p) + 2*nLuts + nFanins)/(1<<20) );
Abc_Print( 1, "\n" );
}
#else
Abc_Print( 1, "Mapping (K=%d) : ", nLutSize );
Abc_Print( 1, "%slut =%7d%s ", "\033[1;33m", nLuts, "\033[0m" ); // yellow
Abc_Print( 1, "%sedge =%8d%s ", "\033[1;32m", nFanins, "\033[0m" ); // green
Abc_Print( 1, "%slev =%5d%s ", "\033[1;36m", LevelMax, "\033[0m" ); // blue
Abc_Print( 1, "%s(%.2f)%s ", "\033[1;36m", (float)Ave / Gia_ManCoNum(p), "\033[0m" );
Abc_Print( 1, "over =%5.1f %% ", 100.0 * Gia_ManComputeOverlap(p) / Gia_ManAndNum(p) );
Abc_Print( 1, "mem =%5.2f MB", 4.0*(Gia_ManObjNum(p) + 2*nLuts + nFanins)/(1<<20) );
Abc_Print( 1, "\n" );
#endif
if ( pDumpFile )
{