Commit b5bde05a by Alan Mishchenko

Passing file name for stats print-out in &ps.

parent f98b58e6
...@@ -195,7 +195,7 @@ struct Gps_Par_t_ ...@@ -195,7 +195,7 @@ struct Gps_Par_t_
int fCut; int fCut;
int fNpn; int fNpn;
int fLutProf; int fLutProf;
int fDumpFile; char * pDumpFile;
}; };
typedef struct Emb_Par_t_ Emb_Par_t; typedef struct Emb_Par_t_ Emb_Par_t;
...@@ -1089,7 +1089,7 @@ extern void Gia_ManHashProfile( Gia_Man_t * p ); ...@@ -1089,7 +1089,7 @@ extern void Gia_ManHashProfile( Gia_Man_t * p );
extern int Gia_ManHashLookup( Gia_Man_t * p, Gia_Obj_t * p0, Gia_Obj_t * p1 ); extern int Gia_ManHashLookup( Gia_Man_t * p, Gia_Obj_t * p0, Gia_Obj_t * p1 );
extern int Gia_ManHashAndMulti( Gia_Man_t * p, Vec_Int_t * vLits ); extern int Gia_ManHashAndMulti( Gia_Man_t * p, Vec_Int_t * vLits );
/*=== giaIf.c ===========================================================*/ /*=== giaIf.c ===========================================================*/
extern void Gia_ManPrintMappingStats( Gia_Man_t * p, int fDumpFile ); extern void Gia_ManPrintMappingStats( Gia_Man_t * p, char * pDumpFile );
extern void Gia_ManPrintPackingStats( Gia_Man_t * p ); extern void Gia_ManPrintPackingStats( Gia_Man_t * p );
extern void Gia_ManPrintLutStats( Gia_Man_t * p ); extern void Gia_ManPrintLutStats( Gia_Man_t * p );
extern int Gia_ManLutFaninCount( Gia_Man_t * p ); extern int Gia_ManLutFaninCount( Gia_Man_t * p );
......
...@@ -305,7 +305,7 @@ int Gia_ManComputeOverlap( Gia_Man_t * p ) ...@@ -305,7 +305,7 @@ int Gia_ManComputeOverlap( Gia_Man_t * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Gia_ManPrintMappingStats( Gia_Man_t * p, int fDumpFile ) void Gia_ManPrintMappingStats( Gia_Man_t * p, char * pDumpFile )
{ {
int * pLevels; int * pLevels;
int i, k, iFan, nLutSize = 0, nLuts = 0, nFanins = 0, LevelMax = 0; int i, k, iFan, nLutSize = 0, nLuts = 0, nFanins = 0, LevelMax = 0;
...@@ -331,12 +331,11 @@ void Gia_ManPrintMappingStats( Gia_Man_t * p, int fDumpFile ) ...@@ -331,12 +331,11 @@ void Gia_ManPrintMappingStats( Gia_Man_t * p, int fDumpFile )
Abc_Print( 1, "mem =%5.2f MB", 4.0*(Gia_ManObjNum(p) + 2*nLuts + nFanins)/(1<<20) ); Abc_Print( 1, "mem =%5.2f MB", 4.0*(Gia_ManObjNum(p) + 2*nLuts + nFanins)/(1<<20) );
Abc_Print( 1, "\n" ); Abc_Print( 1, "\n" );
if ( fDumpFile ) if ( pDumpFile )
{ {
char * pFileName = "stats_map.txt";
static char FileNameOld[1000] = {0}; static char FileNameOld[1000] = {0};
static abctime clk = 0; static abctime clk = 0;
FILE * pTable = fopen( pFileName, "a+" ); FILE * pTable = fopen( pDumpFile, "a+" );
if ( strcmp( FileNameOld, p->pName ) ) if ( strcmp( FileNameOld, p->pName ) )
{ {
sprintf( FileNameOld, "%s", p->pName ); sprintf( FileNameOld, "%s", p->pName );
......
...@@ -369,7 +369,7 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars ) ...@@ -369,7 +369,7 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars )
if ( p->pSibls ) if ( p->pSibls )
Gia_ManPrintChoiceStats( p ); Gia_ManPrintChoiceStats( p );
if ( Gia_ManHasMapping(p) ) if ( Gia_ManHasMapping(p) )
Gia_ManPrintMappingStats( p, pPars && pPars->fDumpFile ); Gia_ManPrintMappingStats( p, pPars ? pPars->pDumpFile : NULL );
if ( pPars && pPars->fNpn && Gia_ManHasMapping(p) && Gia_ManLutSizeMax(p) <= 4 ) if ( pPars && pPars->fNpn && Gia_ManHasMapping(p) && Gia_ManLutSizeMax(p) <= 4 )
Gia_ManPrintNpnClasses( p ); Gia_ManPrintNpnClasses( p );
if ( p->vPacking ) if ( p->vPacking )
......
...@@ -25083,7 +25083,7 @@ int Abc_CommandAbc9Ps( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -25083,7 +25083,7 @@ int Abc_CommandAbc9Ps( Abc_Frame_t * pAbc, int argc, char ** argv )
int c; int c;
memset( pPars, 0, sizeof(Gps_Par_t) ); memset( pPars, 0, sizeof(Gps_Par_t) );
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "tpcnldh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "Dtpcnlh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -25102,8 +25102,14 @@ int Abc_CommandAbc9Ps( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -25102,8 +25102,14 @@ int Abc_CommandAbc9Ps( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'l': case 'l':
pPars->fLutProf ^= 1; pPars->fLutProf ^= 1;
break; break;
case 'd': case 'D':
pPars->fDumpFile ^= 1; if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-D\" should be followed by a file name.\n" );
goto usage;
}
pPars->pDumpFile = argv[globalUtilOptind];
globalUtilOptind++;
break; break;
case 'h': case 'h':
goto usage; goto usage;
...@@ -25120,14 +25126,14 @@ int Abc_CommandAbc9Ps( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -25120,14 +25126,14 @@ int Abc_CommandAbc9Ps( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: &ps [-tpcnldh]\n" ); Abc_Print( -2, "usage: &ps [-tpcnlh] [-D file]\n" );
Abc_Print( -2, "\t prints stats of the current AIG\n" ); Abc_Print( -2, "\t prints stats of the current AIG\n" );
Abc_Print( -2, "\t-t : toggle printing BMC tents [default = %s]\n", pPars->fTents? "yes": "no" ); Abc_Print( -2, "\t-t : toggle printing BMC tents [default = %s]\n", pPars->fTents? "yes": "no" );
Abc_Print( -2, "\t-p : toggle printing switching activity [default = %s]\n", pPars->fSwitch? "yes": "no" ); Abc_Print( -2, "\t-p : toggle printing switching activity [default = %s]\n", pPars->fSwitch? "yes": "no" );
Abc_Print( -2, "\t-c : toggle printing the size of frontier cut [default = %s]\n", pPars->fCut? "yes": "no" ); Abc_Print( -2, "\t-c : toggle printing the size of frontier cut [default = %s]\n", pPars->fCut? "yes": "no" );
Abc_Print( -2, "\t-n : toggle printing NPN classes of functions [default = %s]\n", pPars->fNpn? "yes": "no" ); Abc_Print( -2, "\t-n : toggle printing NPN classes of functions [default = %s]\n", pPars->fNpn? "yes": "no" );
Abc_Print( -2, "\t-l : toggle printing LUT size profile [default = %s]\n", pPars->fLutProf? "yes": "no" ); Abc_Print( -2, "\t-l : toggle printing LUT size profile [default = %s]\n", pPars->fLutProf? "yes": "no" );
Abc_Print( -2, "\t-d : toggle dumping statistics into a file [default = %s]\n", pPars->fDumpFile? "yes": "no" ); Abc_Print( -2, "\t-D file : file name to dump statistics [default = none]\n" );
Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-h : print the command usage\n");
return 1; return 1;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment