summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-12-11 15:22:17 -0700
committerBrian Paul <brianp@vmware.com>2009-12-21 13:49:25 -0700
commit79e74cda7347170f1015829ceafb0f5f18dd9236 (patch)
treed40c7698e591e73a9d9119cf9f7e0ed082202986
parentf44f6473e60fdcde24b0d8b166fce8a2ffe366b7 (diff)
downloadmesa-79e74cda7347170f1015829ceafb0f5f18dd9236.tar.gz
progs/demos: report pixel rate in million pixels / sec
-rw-r--r--progs/demos/readpix.c9
1 files changed, 5 insertions, 4 deletions
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 {