gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog gui/gui.cpp gui/gui.h


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash ChangeLog gui/gui.cpp gui/gui.h
Date: Mon, 02 Jul 2007 17:17:02 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   07/07/02 17:17:02

Modified files:
        .              : ChangeLog 
        gui            : gui.cpp gui.h 

Log message:
        add fpsCounterTick() for FPS profiling

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3637&r2=1.3638
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.81&r2=1.82
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.53&r2=1.54

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.3637
retrieving revision 1.3638
diff -u -b -r1.3637 -r1.3638
--- ChangeLog   2 Jul 2007 16:31:21 -0000       1.3637
+++ ChangeLog   2 Jul 2007 17:17:01 -0000       1.3638
@@ -1,3 +1,7 @@
+2007-07-02 Udo Giacomozzi <address@hidden>
+
+       * gui/gui.{cpp,h}: add fpsCounterTick() for FPS profiling
+
 2007-07-02 Sandro Santilli <address@hidden>
 
        * configure.ac: add --enable-fps-debug switch to define

Index: gui/gui.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -b -r1.81 -r1.82
--- gui/gui.cpp 1 Jul 2007 10:54:03 -0000       1.81
+++ gui/gui.cpp 2 Jul 2007 17:17:02 -0000       1.82
@@ -30,6 +30,10 @@
 #include "movie_root.h"
 #include "VM.h"
 
+#ifdef GNASH_FPS_DEBUG
+#include "tu_timer.cpp"
+#endif
+
 #include <cstdio>
 #include <cstring>
 
@@ -95,6 +99,11 @@
     _renderer(NULL),
     _redraw_flag(true),
     _stopped(false)
+#ifdef GNASH_FPS_DEBUG
+    ,fps_counter(0)    
+    ,fps_counter_total(0)    
+    ,fps_timer(0.0)
+#endif        
 {
 }
 
@@ -453,6 +462,10 @@
 
        gnash::movie_root* m = gnash::get_current_root();
 
+#ifdef GNASH_FPS_DEBUG
+       gui->fpsCounterTick(1.0);  // <-- will be based on cmd.line settings
+#endif
+
 // Define REVIEW_ALL_FRAMES to have *all* frames
 // consequencially displaied. Useful for debugging.
 //#define REVIEW_ALL_FRAMES 1
@@ -546,6 +559,31 @@
        setInvalidatedRegion(bounds);
 }
 
+#ifdef GNASH_FPS_DEBUG
+void 
+Gui::fpsCounterTick(float interval)
+{
+  uint64_t current_timer = tu_timer::get_ticks();
+  uint64_t interval_ms = (int)(interval * 1000.0);
+  
+  fps_counter++;
+  fps_counter_total++;
+  
+  if (current_timer - fps_timer >= interval_ms) {
+  
+    float secs = (current_timer - fps_timer) / 1000.0;
+  
+    //log_msg("Effective frame rate: %0.2f fps", (float)(fps_counter/secs));
+    printf("Effective frame rate: %0.2f fps (%d frames total)\n", 
+      (float)(fps_counter/secs), fps_counter_total);
+      
+    fps_counter = 0;
+    fps_timer = current_timer;
+  
+  }
+   
+}
+#endif
 
 // end of namespace
 }

Index: gui/gui.h
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/gui.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- gui/gui.h   1 Jul 2007 10:54:03 -0000       1.53
+++ gui/gui.h   2 Jul 2007 17:17:02 -0000       1.54
@@ -284,6 +284,17 @@
 
     bool display(movie_root* m);
 
+#ifdef GNASH_FPS_DEBUG
+    unsigned int fps_counter;
+    unsigned int fps_counter_total;
+    uint64_t fps_timer;     
+    
+    void fpsCounterTick(float interval);
+    /// Should be called on every frame advance (including inter-frames caused
+    /// by mouse events). <interval> is the time, in seconds, between log_msg
+    /// prints (which also resets the fps counter). interval must be >= 0
+#endif
+
 };
 
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]