From 7596bd41c2fafd028f0bbc56cf01188961d94cfc Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 10 Oct 2019 19:42:33 +0200 Subject: [PATCH] Add benchmark of drawing cross hair There is a special API to draw cross hair so it would be good have ability to test its performance. --- tests/benchmarks/graphics.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/benchmarks/graphics.cpp b/tests/benchmarks/graphics.cpp index 9fbf8a7590..9a5a180e32 100644 --- a/tests/benchmarks/graphics.cpp +++ b/tests/benchmarks/graphics.cpp @@ -468,6 +468,23 @@ private: wxPrintf("%ld vertical lines done in %ldms = %gus/line\n", opts.numIters, t3, (1000. * t3) / opts.numIters); + + // Cross hair + wxPrintf("Benchmarking %s: ", msg); + fflush(stdout); + + sw.Start(); + for ( int n = 0; n < opts.numIters; n++ ) + { + x0 = rand() % opts.width; + y0 = rand() % opts.height; + + dc.CrossHair(x0, y0); + } + const long t4 = sw.Time(); + + wxPrintf("%ld cross hairs done in %ldms = %gus/line\n", + opts.numIters, t4, (1000. * t4) / (2*opts.numIters)); }