Mesa (mesa_7_7_branch): progs/demos: report pixel rate in million pixels / sec

Brian Paul brianp at kemper.freedesktop.org
Mon Dec 21 20:49:37 UTC 2009


Module: Mesa
Branch: mesa_7_7_branch
Commit: 79e74cda7347170f1015829ceafb0f5f18dd9236
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=79e74cda7347170f1015829ceafb0f5f18dd9236

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Dec 11 15:22:17 2009 -0700

progs/demos: report pixel rate in million pixels / sec

---

 progs/demos/readpix.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/progs/demos/readpix.c b/progs/demos/readpix.c
index bbb3a68..182b01d 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 {




More information about the mesa-commit mailing list