allow specifying initialization and cleanup functions for benchmarks

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56359 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-10-16 12:34:47 +00:00
parent 04021d6fac
commit fa8825a01d
2 changed files with 32 additions and 8 deletions

View File

@@ -254,8 +254,8 @@ int BenchApp::OnRun()
long timeMin = LONG_MAX,
timeMax = 0,
timeTotal = 0;
bool ok = true;
for ( long a = 0; a < m_avgCount; a++ )
bool ok = func->Init();
for ( long a = 0; ok && a < m_avgCount; a++ )
{
wxStopWatch sw;
for ( long n = 0; n < m_numRuns && ok; n++ )
@@ -265,9 +265,6 @@ int BenchApp::OnRun()
sw.Pause();
if ( !ok )
break;
const long t = sw.Time();
if ( t < timeMin )
timeMin = t;
@@ -276,6 +273,8 @@ int BenchApp::OnRun()
timeTotal += t;
}
func->Done();
if ( !ok )
{
wxPrintf("ERROR\n");