Demos (master): demos: flush stdout after printing frame rate

Brian Paul brianp at kemper.freedesktop.org
Mon Jun 22 19:56:50 UTC 2015


Module: Demos
Branch: master
Commit: 3d5e8e181a3d65ffd41a17110a8e552244d9f7bd
URL:    http://cgit.freedesktop.org/mesa/demos/commit/?id=3d5e8e181a3d65ffd41a17110a8e552244d9f7bd

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Jun 22 13:42:44 2015 -0600

demos: flush stdout after printing frame rate

To get immediate output on Windows.
Trivial.

---

 src/demos/fbo_firecube.c |    3 ++-
 src/demos/fire.c         |    1 +
 src/demos/teapot.c       |    1 +
 src/demos/terrain.c      |    1 +
 src/demos/trispd.c       |    1 +
 src/demos/tunnel.c       |    1 +
 src/demos/tunnel2.c      |    1 +
 7 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/demos/fbo_firecube.c b/src/demos/fbo_firecube.c
index 333c04c..eefbb64 100644
--- a/src/demos/fbo_firecube.c
+++ b/src/demos/fbo_firecube.c
@@ -584,7 +584,8 @@ drawfire(void)
 	 GLfloat seconds = (t - T0) / 1000.0;
 	 GLfloat fps = Frames / seconds;
 	 sprintf(frbuf, "Frame rate: %f", fps);
-         printf("%s\n", frbuf);
+	 printf("%s\n", frbuf);
+	 fflush(stdout);
 	 T0 = t;
 	 Frames = 0;
       }
diff --git a/src/demos/fire.c b/src/demos/fire.c
index c40278b..34fac44 100644
--- a/src/demos/fire.c
+++ b/src/demos/fire.c
@@ -529,6 +529,7 @@ drawfire(void)
          GLfloat fps = Frames / seconds;
          sprintf(frbuf, "Frame rate: %f", fps);
          printf("%s\n", frbuf);
+         fflush(stdout);
          T0 = t;
          Frames = 0;
       }
diff --git a/src/demos/teapot.c b/src/demos/teapot.c
index f75ad94..23d2225 100644
--- a/src/demos/teapot.c
+++ b/src/demos/teapot.c
@@ -491,6 +491,7 @@ static void draw(void)
          GLfloat fps = Frames / seconds;
          sprintf(frbuf, "Frame rate: %f", fps);
          printf("%s\n", frbuf);
+         fflush(stdout);
          T0 = t;
          Frames = 0;
       }
diff --git a/src/demos/terrain.c b/src/demos/terrain.c
index 435912a..9e3629d 100644
--- a/src/demos/terrain.c
+++ b/src/demos/terrain.c
@@ -426,6 +426,7 @@ drawscene(void)
          GLfloat fps = Frames / seconds;
          sprintf(frbuf, "Frame rate: %f", fps);
          printf("%s\n", frbuf);
+         fflush(stdout);
          T0 = t;
          Frames = 0;
       }
diff --git a/src/demos/trispd.c b/src/demos/trispd.c
index 0c7ad6e..d6e231e 100644
--- a/src/demos/trispd.c
+++ b/src/demos/trispd.c
@@ -95,6 +95,7 @@ static void Display( void )
    pixelRate = triRate * Size;
    printf("Rate: %d tri in %gs = %g tri/s  %d pixels/s\n",
           triCount, t1-t0, triRate, (int)pixelRate);
+   fflush(stdout);
 
    glutSwapBuffers();
 }
diff --git a/src/demos/tunnel.c b/src/demos/tunnel.c
index 6e48ad4..dea689e 100644
--- a/src/demos/tunnel.c
+++ b/src/demos/tunnel.c
@@ -470,6 +470,7 @@ draw(void)
          GLfloat fps = Frames / seconds;
          sprintf(frbuf, "Frame rate: %f", fps);
          printf("%s\n", frbuf);
+         fflush(stdout);
          T0 = t;
          Frames = 0;
       }
diff --git a/src/demos/tunnel2.c b/src/demos/tunnel2.c
index 800ea7b..1126a38 100644
--- a/src/demos/tunnel2.c
+++ b/src/demos/tunnel2.c
@@ -491,6 +491,7 @@ draw(void)
          GLfloat fps = Frames / seconds;
          sprintf(frbuf, "Frame rate: %f", fps);
          printf("%s\n", frbuf);
+         fflush(stdout);
          T0 = t;
          Frames = 0;
       }




More information about the mesa-commit mailing list