From: Brian Paul Date: Fri, 11 Dec 2009 22:22:17 +0000 (-0700) Subject: progs/demos: report pixel rate in million pixels / sec X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=79e74cda7347170f1015829ceafb0f5f18dd9236;p=mesa.git progs/demos: report pixel rate in million pixels / sec --- diff --git a/progs/demos/readpix.c b/progs/demos/readpix.c index bbb3a68effa..182b01d7ffc 100644 --- a/progs/demos/readpix.c +++ b/progs/demos/readpix.c @@ -219,7 +219,7 @@ Display( void ) GLint reads = 0; GLint endTime; GLint startTime = glutGet(GLUT_ELAPSED_TIME); - GLdouble seconds, pixelsPerSecond; + GLdouble seconds, mpixels, mpixelsPerSecond; printf("Benchmarking...\n"); do { glReadPixels(APosX, APosY, ImgWidth, ImgHeight, @@ -228,9 +228,10 @@ Display( void ) endTime = glutGet(GLUT_ELAPSED_TIME); } while (endTime - startTime < 4000); /* 4 seconds */ seconds = (double) (endTime - startTime) / 1000.0; - pixelsPerSecond = reads * ImgWidth * ImgHeight / seconds; - printf("Result: %d reads in %f seconds = %f pixels/sec\n", - reads, seconds, pixelsPerSecond); + mpixels = reads * (ImgWidth * ImgHeight / (1000.0 * 1000.0)); + mpixelsPerSecond = mpixels / seconds; + printf("Result: %d reads in %f seconds = %f Mpixels/sec\n", + reads, seconds, mpixelsPerSecond); Benchmark = GL_FALSE; } else {