Remove now unused tools/debug.hxx profiling functionality

Change-Id: I13adca8c2f929c8a9226b26ef57b26363dfdf0b3
This commit is contained in:
Stephan Bergmann
2014-03-25 18:48:45 +01:00
parent 62a8fa8fce
commit cdb473b00a
6 changed files with 1 additions and 246 deletions

View File

@@ -54,7 +54,6 @@ typedef void (*DbgTestSolarMutexProc)();
#define DBG_TEST_XTOR_REPORT (0x00000008) #define DBG_TEST_XTOR_REPORT (0x00000008)
#define DBG_TEST_XTOR_TRACE (0x00000010) #define DBG_TEST_XTOR_TRACE (0x00000010)
#define DBG_TEST_PROFILING (0x01000000)
#define DBG_TEST_RESOURCE (0x02000000) #define DBG_TEST_RESOURCE (0x02000000)
#define DBG_TEST_DIALOG (0x04000000) #define DBG_TEST_DIALOG (0x04000000)
#define DBG_TEST_BOLDAPPFONT (0x08000000) #define DBG_TEST_BOLDAPPFONT (0x08000000)
@@ -96,7 +95,6 @@ struct DbgDataType
// Dbg prototypes // Dbg prototypes
#define DBG_FUNC_DEBUGSTART 1 #define DBG_FUNC_DEBUGSTART 1
#define DBG_FUNC_DEBUGEND 2 #define DBG_FUNC_DEBUGEND 2
#define DBG_FUNC_GLOBALDEBUGEND 3
#define DBG_FUNC_GETDATA 4 #define DBG_FUNC_GETDATA 4
#define DBG_FUNC_SAVEDATA 5 #define DBG_FUNC_SAVEDATA 5
#define DBG_FUNC_SETPRINTMSGBOX 6 #define DBG_FUNC_SETPRINTMSGBOX 6
@@ -121,11 +119,6 @@ inline void DbgDebugEnd()
DbgFunc( DBG_FUNC_DEBUGEND ); DbgFunc( DBG_FUNC_DEBUGEND );
} }
inline void DbgGlobalDebugEnd()
{
DbgFunc( DBG_FUNC_GLOBALDEBUGEND );
}
inline void DbgSetPrintMsgBox( DbgPrintLine pProc ) inline void DbgSetPrintMsgBox( DbgPrintLine pProc )
{ {
DbgFunc( DBG_FUNC_SETPRINTMSGBOX, (void*)(long)pProc ); DbgFunc( DBG_FUNC_SETPRINTMSGBOX, (void*)(long)pProc );
@@ -246,13 +239,6 @@ TOOLS_DLLPUBLIC void DbgOutTypef( sal_uInt16 nOutType, const sal_Char* pFStr, ..
// Dbg test functions // Dbg test functions
#define DBG_PROF_START 1
#define DBG_PROF_STOP 2
#define DBG_PROF_CONTINUE 3
#define DBG_PROF_PAUSE 4
TOOLS_DLLPUBLIC void DbgProf( sal_uInt16 nAction, DbgDataType* );
#define DBG_XTOR_CTOR 1 #define DBG_XTOR_CTOR 1
#define DBG_XTOR_DTOR 2 #define DBG_XTOR_DTOR 2
#define DBG_XTOR_CHKTHIS 3 #define DBG_XTOR_CHKTHIS 3
@@ -300,19 +286,6 @@ public:
#define DBG_DEBUGSTART() DbgDebugStart() #define DBG_DEBUGSTART() DbgDebugStart()
#define DBG_DEBUGEND() DbgDebugEnd() #define DBG_DEBUGEND() DbgDebugEnd()
#define DBG_GLOBALDEBUGEND() DbgGlobalDebugEnd()
#define DBG_PROFSTART( aName ) \
DbgProf( DBG_PROF_START, DBG_FUNC( aName ) )
#define DBG_PROFSTOP( aName ) \
DbgProf( DBG_PROF_STOP, DBG_FUNC( aName ) )
#define DBG_PROFCONTINUE( aName ) \
DbgProf( DBG_PROF_CONTINUE, DBG_FUNC( aName ) )
#define DBG_PROFPAUSE( aName ) \
DbgProf( DBG_PROF_PAUSE, DBG_FUNC( aName ) )
#define DBG_CTOR( aName, fTest ) \ #define DBG_CTOR( aName, fTest ) \
DbgXtorObj aDbgXtorObj( DBG_FUNC( aName ), \ DbgXtorObj aDbgXtorObj( DBG_FUNC( aName ), \
@@ -385,17 +358,11 @@ typedef const sal_Char* (*DbgUsr)(const void* pThis );
#define DBG_DEBUGSTART() ((void)0) #define DBG_DEBUGSTART() ((void)0)
#define DBG_DEBUGEND() ((void)0) #define DBG_DEBUGEND() ((void)0)
#define DBG_GLOBALDEBUGEND() ((void)0)
#define DBG_NAME( aName ) #define DBG_NAME( aName )
#define DBG_NAMEEX( aName ) #define DBG_NAMEEX( aName )
#define DBG_NAMEEX_VISIBILITY( aName, vis ) #define DBG_NAMEEX_VISIBILITY( aName, vis )
#define DBG_PROFSTART( aName ) ((void)0)
#define DBG_PROFSTOP( aName ) ((void)0)
#define DBG_PROFCONTINUE( aName ) ((void)0)
#define DBG_PROFPAUSE( aName ) ((void)0)
#define DBG_CTOR( aName, fTest ) ((void)0) #define DBG_CTOR( aName, fTest ) ((void)0)
#define DBG_DTOR( aName, fTest ) ((void)0) #define DBG_DTOR( aName, fTest ) ((void)0)
#define DBG_CHKTHIS( aName, fTest ) ((void)0) #define DBG_CHKTHIS( aName, fTest ) ((void)0)

View File

@@ -25,7 +25,6 @@
// Methoden, die von VCL gerufen werden muessen // Methoden, die von VCL gerufen werden muessen
TOOLS_DLLPUBLIC void InitTools(); TOOLS_DLLPUBLIC void InitTools();
TOOLS_DLLPUBLIC void DeInitTools(); TOOLS_DLLPUBLIC void DeInitTools();
TOOLS_DLLPUBLIC void GlobalDeInitTools();
#endif #endif

View File

@@ -84,18 +84,6 @@ public:
#define DBG_MAXNAME 28 #define DBG_MAXNAME 28
struct ProfType
{
sal_uIntPtr nCount;
sal_uIntPtr nTime;
sal_uIntPtr nMinTime;
sal_uIntPtr nMaxTime;
sal_uIntPtr nStart;
sal_uIntPtr nContinueTime;
sal_uIntPtr nContinueStart;
sal_Char aName[DBG_MAXNAME+1];
};
struct XtorType struct XtorType
{ {
sal_uIntPtr nCtorCalls; sal_uIntPtr nCtorCalls;
@@ -116,7 +104,6 @@ struct DebugData
DbgPrintLine pDbgAbort; DbgPrintLine pDbgAbort;
::std::vector< DbgPrintLine > ::std::vector< DbgPrintLine >
aDbgPrintUserChannels; aDbgPrintUserChannels;
PointerList* pProfList;
PointerList* pXtorList; PointerList* pXtorList;
DbgTestSolarMutexProc pDbgTestSolarMutex; DbgTestSolarMutexProc pDbgTestSolarMutex;
@@ -125,7 +112,6 @@ struct DebugData
,pDbgPrintMsgBox( NULL ) ,pDbgPrintMsgBox( NULL )
,pDbgPrintWindow( NULL ) ,pDbgPrintWindow( NULL )
,pDbgAbort( NULL ) ,pDbgAbort( NULL )
,pProfList( NULL )
,pXtorList( NULL ) ,pXtorList( NULL )
,pDbgTestSolarMutex( NULL ) ,pDbgTestSolarMutex( NULL )
{ {
@@ -225,28 +211,6 @@ static bool ImplCoreDump()
return true; return true;
} }
static sal_uIntPtr ImplGetPerfTime()
{
#if defined( WNT )
return (sal_uIntPtr)GetTickCount();
#else
static sal_uIntPtr nImplTicksPerSecond = 0;
static double dImplTicksPerSecond;
sal_uIntPtr nTicks = (sal_uIntPtr)clock();
if ( !nImplTicksPerSecond )
{
nImplTicksPerSecond = CLOCKS_PER_SEC;
dImplTicksPerSecond = nImplTicksPerSecond;
}
double fTicks = nTicks;
fTicks *= 1000;
fTicks /= dImplTicksPerSecond;
return (sal_uIntPtr)fTicks;
#endif
}
typedef FILE* FILETYPE; typedef FILE* FILETYPE;
#define FileOpen fopen #define FileOpen fopen
#define FileRead fread #define FileRead fread
@@ -648,7 +612,6 @@ static DebugData* GetDebugData()
// elements of the [test] section // elements of the [test] section
if ( eCurrentSection == eTest ) if ( eCurrentSection == eTest )
{ {
lcl_tryReadConfigFlag( pLine, nLineLength, "profiling", &aDebugData.aDbgData.nTestFlags, DBG_TEST_PROFILING );
lcl_tryReadConfigFlag( pLine, nLineLength, "resources", &aDebugData.aDbgData.nTestFlags, DBG_TEST_RESOURCE ); lcl_tryReadConfigFlag( pLine, nLineLength, "resources", &aDebugData.aDbgData.nTestFlags, DBG_TEST_RESOURCE );
lcl_tryReadConfigFlag( pLine, nLineLength, "dialog", &aDebugData.aDbgData.nTestFlags, DBG_TEST_DIALOG ); lcl_tryReadConfigFlag( pLine, nLineLength, "dialog", &aDebugData.aDbgData.nTestFlags, DBG_TEST_DIALOG );
lcl_tryReadConfigFlag( pLine, nLineLength, "bold_app_font", &aDebugData.aDbgData.nTestFlags, DBG_TEST_BOLDAPPFONT ); lcl_tryReadConfigFlag( pLine, nLineLength, "bold_app_font", &aDebugData.aDbgData.nTestFlags, DBG_TEST_BOLDAPPFONT );
@@ -675,8 +638,6 @@ static DebugData* GetDebugData()
// initialize debug data // initialize debug data
if ( aDebugData.aDbgData.nTestFlags & DBG_TEST_XTOR ) if ( aDebugData.aDbgData.nTestFlags & DBG_TEST_XTOR )
aDebugData.pXtorList = new PointerList; aDebugData.pXtorList = new PointerList;
if ( aDebugData.aDbgData.nTestFlags & DBG_TEST_PROFILING )
aDebugData.pProfList = new PointerList;
} }
return &aDebugData; return &aDebugData;
@@ -868,61 +829,12 @@ static void DebugDeInit()
// for global variables will crash, // for global variables will crash,
// as pointer alignment won't work then. // as pointer alignment won't work then.
pData->aDbgData.nTraceOut = nOldOut; pData->aDbgData.nTraceOut = nOldOut;
pData->aDbgData.nTestFlags &= DBG_TEST_PROFILING; pData->aDbgData.nTestFlags = 0;
pData->aDbgPrintUserChannels.clear(); pData->aDbgPrintUserChannels.clear();
pData->pDbgPrintWindow = NULL; pData->pDbgPrintWindow = NULL;
ImplDbgDeInitLock(); ImplDbgDeInitLock();
} }
static void DebugGlobalDeInit()
{
DebugData* pData = GetDebugData();
sal_uIntPtr i;
sal_uIntPtr nCount;
sal_uIntPtr nOldOut;
// Output statistics trace data to file
nOldOut = pData->aDbgData.nTraceOut;
pData->aDbgData.nTraceOut = DBG_OUT_FILE;
// output profile liste
if ( pData->pProfList && pData->pProfList->Count() )
{
DbgOutf( "------------------------------------------------------------------------------" );
DbgOutf( "Profiling Report" );
DbgOutf( "------------------------------------------------------------------------------" );
DbgOutf( "%-25s : %-9s : %-6s : %-6s : %-6s : %-9s :",
"Prof-List (ms)", "Time", "Min", "Max", "Ave", "Count" );
DbgOutf( "--------------------------:-----------:--------:--------:--------:-----------:" );
for( i = 0, nCount = pData->pProfList->Count(); i < nCount; i++ )
{
ProfType* pProfData = (ProfType*)pData->pProfList->Get( i );
sal_uIntPtr nAve = pProfData->nTime / pProfData->nCount;
DbgOutf( "%-25s : %9lu : %6lu : %6lu : %6lu : %9lu :",
pProfData->aName, pProfData->nTime,
pProfData->nMinTime, pProfData->nMaxTime, nAve,
pProfData->nCount );
}
DbgOutf( "==============================================================================" );
}
// free profile list
if ( pData->pProfList )
{
for( i = 0, nCount = pData->pProfList->Count(); i < nCount; i++ )
{
ProfType* pProfData = (ProfType*)pData->pProfList->Get( i );
delete pProfData;
}
delete pData->pProfList;
pData->pProfList = NULL;
}
// disable profiling flags
pData->aDbgData.nTraceOut = nOldOut;
pData->aDbgData.nTestFlags &= ~DBG_TEST_PROFILING;
}
void ImpDbgOutfBuf( sal_Char* pBuf, const sal_Char* pFStr, ... ) void ImpDbgOutfBuf( sal_Char* pBuf, const sal_Char* pFStr, ... )
{ {
va_list pList; va_list pList;
@@ -996,10 +908,6 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam )
DebugDeInit(); DebugDeInit();
break; break;
case DBG_FUNC_GLOBALDEBUGEND:
DebugGlobalDeInit();
break;
case DBG_FUNC_SETPRINTMSGBOX: case DBG_FUNC_SETPRINTMSGBOX:
pDebugData->pDbgPrintMsgBox = (DbgPrintLine)(long)pParam; pDebugData->pDbgPrintMsgBox = (DbgPrintLine)(long)pParam;
break; break;
@@ -1046,7 +954,6 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam )
lcl_lineFeed( pIniFile ); lcl_lineFeed( pIniFile );
lcl_startSection( pIniFile, eTest ); lcl_startSection( pIniFile, eTest );
lcl_writeConfigFlag( pIniFile, "profiling", pData->nTestFlags, DBG_TEST_PROFILING );
lcl_writeConfigFlag( pIniFile, "resources", pData->nTestFlags, DBG_TEST_RESOURCE ); lcl_writeConfigFlag( pIniFile, "resources", pData->nTestFlags, DBG_TEST_RESOURCE );
lcl_writeConfigFlag( pIniFile, "dialog", pData->nTestFlags, DBG_TEST_DIALOG ); lcl_writeConfigFlag( pIniFile, "dialog", pData->nTestFlags, DBG_TEST_DIALOG );
lcl_writeConfigFlag( pIniFile, "bold_app_font", pData->nTestFlags, DBG_TEST_BOLDAPPFONT ); lcl_writeConfigFlag( pIniFile, "bold_app_font", pData->nTestFlags, DBG_TEST_BOLDAPPFONT );
@@ -1094,96 +1001,6 @@ DbgChannelId DbgRegisterUserChannel( DbgPrintLine pProc )
return (DbgChannelId)( pData->aDbgPrintUserChannels.size() - 1 + DBG_OUT_USER_CHANNEL_0 ); return (DbgChannelId)( pData->aDbgPrintUserChannels.size() - 1 + DBG_OUT_USER_CHANNEL_0 );
} }
void DbgProf( sal_uInt16 nAction, DbgDataType* pDbgData )
{
DebugData* pData = ImplGetDebugData();
if ( !(pData->aDbgData.nTestFlags & DBG_TEST_PROFILING) )
return;
ProfType* pProfData = (ProfType*)pDbgData->pData;
sal_uIntPtr nTime;
if ( (nAction != DBG_PROF_START) && !pProfData )
{
SAL_WARN(
"tools.debug",
"DBG_PROF...() without DBG_PROFSTART(): " << pDbgData->pName);
return;
}
switch ( nAction )
{
case DBG_PROF_START:
if ( !pDbgData->pData )
{
pDbgData->pData = (void*)new ProfType;
pProfData = (ProfType*)pDbgData->pData;
strncpy( pProfData->aName, pDbgData->pName, DBG_MAXNAME );
pProfData->aName[DBG_MAXNAME] = '\0';
pProfData->nCount = 0;
pProfData->nTime = 0;
pProfData->nMinTime = 0xFFFFFFFF;
pProfData->nMaxTime = 0;
pProfData->nStart = 0xFFFFFFFF;
pProfData->nContinueTime = 0;
pProfData->nContinueStart = 0xFFFFFFFF;
pData->pProfList->Add( (void*)pProfData );
}
if ( pProfData->nStart == 0xFFFFFFFF )
{
pProfData->nStart = ImplGetPerfTime();
pProfData->nCount++;
}
break;
case DBG_PROF_STOP:
nTime = ImplGetPerfTime();
if ( pProfData->nStart == 0xFFFFFFFF )
{
SAL_WARN(
"tools.debug", "DBG_PROF...() without DBG_PROFSTART()");
return;
}
if ( pProfData->nContinueStart != 0xFFFFFFFF )
{
pProfData->nContinueTime += ImplGetPerfTime() - pProfData->nContinueStart;
pProfData->nContinueStart = 0xFFFFFFFF;
}
nTime -= pProfData->nStart;
nTime -= pProfData->nContinueTime;
if ( nTime < pProfData->nMinTime )
pProfData->nMinTime = nTime;
if ( nTime > pProfData->nMaxTime )
pProfData->nMaxTime = nTime;
pProfData->nTime += nTime;
pProfData->nStart = 0xFFFFFFFF;
pProfData->nContinueTime = 0;
pProfData->nContinueStart = 0xFFFFFFFF;
break;
case DBG_PROF_CONTINUE:
if ( pProfData->nContinueStart != 0xFFFFFFFF )
{
pProfData->nContinueTime += ImplGetPerfTime() - pProfData->nContinueStart;
pProfData->nContinueStart = 0xFFFFFFFF;
}
break;
case DBG_PROF_PAUSE:
if ( pProfData->nContinueStart == 0xFFFFFFFF )
pProfData->nContinueStart = ImplGetPerfTime();
break;
}
}
void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis, void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis,
DbgUsr fDbgUsr ) DbgUsr fDbgUsr )
{ {
@@ -1486,7 +1303,6 @@ void DbgOutf( const sal_Char* pFStr, ... )
void* DbgFunc( sal_uInt16, void* ) { return NULL; } void* DbgFunc( sal_uInt16, void* ) { return NULL; }
void DbgProf( sal_uInt16, DbgDataType* ) {}
void DbgXtor( DbgDataType*, sal_uInt16, const void*, DbgUsr ) {} void DbgXtor( DbgDataType*, sal_uInt16, const void*, DbgUsr ) {}
void DbgOutTypef( sal_uInt16, const sal_Char*, ... ) {} void DbgOutTypef( sal_uInt16, const sal_Char*, ... ) {}

View File

@@ -31,9 +31,4 @@ void DeInitTools()
DBG_DEBUGEND(); DBG_DEBUGEND();
} }
void GlobalDeInitTools()
{
DBG_GLOBALDEBUGEND();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -80,13 +80,6 @@ static const sal_Char* pDbgHelpText[] =
"\nOther tests and macros\n", "\nOther tests and macros\n",
"------------------------------------------\n", "------------------------------------------\n",
"\n", "\n",
"Profiling\n",
"DBG_PROFSTART() / DBG_PROFSTOP() / DBG_PROFCONTINUE() / DBG_PROFPAUSE() "
"are evaluated and at the end of the program the number of run throughs "
"and the time this took (including calls to children) in milliseconds is "
"output. These macros can be used to check the same function runs over the "
"entire development period, for example the startup speed. The registered name "
"\n",
"Resources\n", "Resources\n",
"In case of resource errors an error dialog is produced before the " "In case of resource errors an error dialog is produced before the "
"exception handler is called.\n", "exception handler is called.\n",
@@ -370,7 +363,6 @@ private:
CheckBox maXtorTrace; CheckBox maXtorTrace;
GroupBox maBox1; GroupBox maBox1;
CheckBox maProf;
CheckBox maRes; CheckBox maRes;
CheckBox maDialog; CheckBox maDialog;
CheckBox maBoldAppFont; CheckBox maBoldAppFont;
@@ -554,7 +546,6 @@ DbgDialog::DbgDialog() :
maXtorReport( this ), maXtorReport( this ),
maXtorTrace( this ), maXtorTrace( this ),
maBox1( this ), maBox1( this ),
maProf( this ),
maRes( this ), maRes( this ),
maDialog( this ), maDialog( this ),
maBoldAppFont( this ), maBoldAppFont( this ),
@@ -635,15 +626,6 @@ DbgDialog::DbgDialog() :
LogicToPixel( Size( 330, 30 ), aAppMap ) ); LogicToPixel( Size( 330, 30 ), aAppMap ) );
} }
{
maProf.Show();
maProf.SetText("~Profiling");
if ( pData->nTestFlags & DBG_TEST_PROFILING )
maProf.Check( true );
maProf.SetPosSizePixel( LogicToPixel( Point( 10, 95 ), aAppMap ),
aButtonSize );
}
{ {
maRes.Show(); maRes.Show();
maRes.SetText("~Resourcen"); maRes.SetText("~Resourcen");
@@ -885,9 +867,6 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
if ( maXtorTrace.IsChecked() ) if ( maXtorTrace.IsChecked() )
aData.nTestFlags |= DBG_TEST_XTOR_TRACE; aData.nTestFlags |= DBG_TEST_XTOR_TRACE;
if ( maProf.IsChecked() )
aData.nTestFlags |= DBG_TEST_PROFILING;
if ( maRes.IsChecked() ) if ( maRes.IsChecked() )
aData.nTestFlags |= DBG_TEST_RESOURCE; aData.nTestFlags |= DBG_TEST_RESOURCE;

View File

@@ -205,7 +205,6 @@ Application::~Application()
DeInitSalData(); DeInitSalData();
ImplGetSVData()->mpApp = NULL; ImplGetSVData()->mpApp = NULL;
ImplDestroySVData(); ImplDestroySVData();
GlobalDeInitTools();
} }
bool Application::QueryExit() bool Application::QueryExit()