No changes, just rename command line option in graphics benchmark test.

It's not used for lines only, so call it "number of iterations" and not
"number of lines" and use "N" instead of "L" option for it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73472 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-02-05 20:47:05 +00:00
parent e45606e991
commit ce0cdeb0b7

View File

@@ -29,7 +29,7 @@ struct GraphicsBenchmarkOptions
width = 800; width = 800;
height = 600; height = 600;
numLines = 10000; numIters = 1000;
testBitmaps = testBitmaps =
testImages = testImages =
@@ -49,7 +49,7 @@ struct GraphicsBenchmarkOptions
penWidth, penWidth,
width, width,
height, height,
numLines; numIters;
bool testBitmaps, bool testBitmaps,
testImages, testImages,
@@ -141,7 +141,7 @@ private:
wxStopWatch sw; wxStopWatch sw;
int x = 0, int x = 0,
y = 0; y = 0;
for ( int n = 0; n < opts.numLines; n++ ) for ( int n = 0; n < opts.numIters; n++ )
{ {
int x1 = rand() % opts.width, int x1 = rand() % opts.width,
y1 = rand() % opts.height; y1 = rand() % opts.height;
@@ -155,7 +155,7 @@ private:
const long t = sw.Time(); const long t = sw.Time();
wxPrintf("%ld lines done in %ldms = %gus/line\n", wxPrintf("%ld lines done in %ldms = %gus/line\n",
opts.numLines, t, (1000. * t)/opts.numLines); opts.numIters, t, (1000. * t)/opts.numIters);
} }
@@ -175,7 +175,7 @@ private:
fflush(stdout); fflush(stdout);
wxStopWatch sw; wxStopWatch sw;
for ( int n = 0; n < opts.numLines; n++ ) for ( int n = 0; n < opts.numIters; n++ )
{ {
int x = rand() % opts.width, int x = rand() % opts.width,
y = rand() % opts.height; y = rand() % opts.height;
@@ -186,7 +186,7 @@ private:
const long t = sw.Time(); const long t = sw.Time();
wxPrintf("%ld rects done in %ldms = %gus/rect\n", wxPrintf("%ld rects done in %ldms = %gus/rect\n",
opts.numLines, t, (1000. * t)/opts.numLines); opts.numIters, t, (1000. * t)/opts.numIters);
} }
void BenchmarkBitmaps(const wxString& msg, wxDC& dc) void BenchmarkBitmaps(const wxString& msg, wxDC& dc)
@@ -203,7 +203,7 @@ private:
fflush(stdout); fflush(stdout);
wxStopWatch sw; wxStopWatch sw;
for ( int n = 0; n < opts.numLines; n++ ) for ( int n = 0; n < opts.numIters; n++ )
{ {
int x = rand() % opts.width, int x = rand() % opts.width,
y = rand() % opts.height; y = rand() % opts.height;
@@ -214,7 +214,7 @@ private:
const long t = sw.Time(); const long t = sw.Time();
wxPrintf("%ld bitmaps done in %ldms = %gus/bitmap\n", wxPrintf("%ld bitmaps done in %ldms = %gus/bitmap\n",
opts.numLines, t, (1000. * t)/opts.numLines); opts.numIters, t, (1000. * t)/opts.numIters);
} }
void BenchmarkImages(const wxString& msg, wxDC& dc) void BenchmarkImages(const wxString& msg, wxDC& dc)
@@ -231,8 +231,7 @@ private:
wxImage image(wxSize(opts.width, opts.height), false /* don't clear */); wxImage image(wxSize(opts.width, opts.height), false /* don't clear */);
wxStopWatch sw; wxStopWatch sw;
const int numImages = opts.numLines; for ( int n = 0; n < opts.numIters; n++ )
for ( int n = 0; n < numImages; n++ )
{ {
image.Clear(n % 256); image.Clear(n % 256);
dc.DrawBitmap(image, 0, 0); dc.DrawBitmap(image, 0, 0);
@@ -241,8 +240,8 @@ private:
const long t = sw.Time(); const long t = sw.Time();
wxPrintf("%ld images done in %ldms = %gus/image or %d FPS\n", wxPrintf("%ld images done in %ldms = %gus/image or %d FPS\n",
numImages, t, (1000. * t)/numImages, opts.numIters, t, (1000. * t)/opts.numIters,
(1000*numImages + t - 1)/t); (1000*opts.numIters + t - 1)/t);
} }
void BenchmarkRawBitmaps(const wxString& msg, wxDC& dc) void BenchmarkRawBitmaps(const wxString& msg, wxDC& dc)
@@ -260,8 +259,7 @@ private:
wxNativePixelData data(bitmap); wxNativePixelData data(bitmap);
wxStopWatch sw; wxStopWatch sw;
const int numImages = opts.numLines; for ( int n = 0; n < opts.numIters; n++ )
for ( int n = 0; n < numImages; n++ )
{ {
const unsigned char c = n % 256; const unsigned char c = n % 256;
{ {
@@ -289,8 +287,8 @@ private:
const long t = sw.Time(); const long t = sw.Time();
wxPrintf("%ld raw bitmaps done in %ldms = %gus/bitmap or %d FPS\n", wxPrintf("%ld raw bitmaps done in %ldms = %gus/bitmap or %d FPS\n",
numImages, t, (1000. * t)/numImages, opts.numIters, t, (1000. * t)/opts.numIters,
(1000*numImages + t - 1)/t); (1000*opts.numIters + t - 1)/t);
} }
@@ -318,7 +316,8 @@ public:
{ wxCMD_LINE_OPTION, "p", "pen-width", "", wxCMD_LINE_VAL_NUMBER }, { wxCMD_LINE_OPTION, "p", "pen-width", "", wxCMD_LINE_VAL_NUMBER },
{ wxCMD_LINE_OPTION, "w", "width", "", wxCMD_LINE_VAL_NUMBER }, { wxCMD_LINE_OPTION, "w", "width", "", wxCMD_LINE_VAL_NUMBER },
{ wxCMD_LINE_OPTION, "h", "height", "", wxCMD_LINE_VAL_NUMBER }, { wxCMD_LINE_OPTION, "h", "height", "", wxCMD_LINE_VAL_NUMBER },
{ wxCMD_LINE_OPTION, "L", "lines", "", wxCMD_LINE_VAL_NUMBER }, { wxCMD_LINE_OPTION, "I", "images", "", wxCMD_LINE_VAL_NUMBER },
{ wxCMD_LINE_OPTION, "N", "number-of-iterations", "", wxCMD_LINE_VAL_NUMBER },
{ wxCMD_LINE_NONE }, { wxCMD_LINE_NONE },
}; };
@@ -336,7 +335,7 @@ public:
return false; return false;
if ( parser.Found("h", &opts.height) && opts.height < 1 ) if ( parser.Found("h", &opts.height) && opts.height < 1 )
return false; return false;
if ( parser.Found("L", &opts.numLines) && opts.numLines < 1 ) if ( parser.Found("N", &opts.numIters) && opts.numIters < 1 )
return false; return false;
opts.testBitmaps = parser.Found("bitmaps"); opts.testBitmaps = parser.Found("bitmaps");