[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog gui/Player.cpp gui/Player.h gui...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog gui/Player.cpp gui/Player.h gui... |
Date: |
Mon, 02 Jul 2007 18:32:53 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/07/02 18:32:53
Modified files:
. : ChangeLog
gui : Player.cpp Player.h gnash.cpp gui.cpp gui.h
Log message:
* gui/gui.{cpp,h}: add setFpsTimerInterval() public method,
change fpsCounterTick() interface to take no arg. Print total
number of frame advances on destruction. All available ifdef
GNASH_FPS_DEBUG.
* gui/Player.{cpp,h}: add a setFpsPrintTime() public method.
Only available ifdef GNASH_FPS_DEBUG.
* gui/gnash.cpp: Add -f switch for fps debugging prints
(long option was not trivial so didn't add it).
Note that if GNASH_FPS_DEBUG is not defined the -f switch
triggers an error.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3638&r2=1.3639
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.57&r2=1.58
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.h?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gnash.cpp?cvsroot=gnash&r1=1.78&r2=1.79
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.82&r2=1.83
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.54&r2=1.55
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3638
retrieving revision 1.3639
diff -u -b -r1.3638 -r1.3639
--- ChangeLog 2 Jul 2007 17:17:01 -0000 1.3638
+++ ChangeLog 2 Jul 2007 18:32:52 -0000 1.3639
@@ -1,3 +1,16 @@
+2007-07-02 Sandro Santilli <address@hidden>
+
+ * gui/gui.{cpp,h}: add setFpsTimerInterval() public method,
+ change fpsCounterTick() interface to take no arg. Print total
+ number of frame advances on destruction. All available ifdef
+ GNASH_FPS_DEBUG.
+ * gui/Player.{cpp,h}: add a setFpsPrintTime() public method.
+ Only available ifdef GNASH_FPS_DEBUG.
+ * gui/gnash.cpp: Add -f switch for fps debugging prints
+ (long option was not trivial so didn't add it).
+ Note that if GNASH_FPS_DEBUG is not defined the -f switch
+ triggers an error.
+
2007-07-02 Udo Giacomozzi <address@hidden>
* gui/gui.{cpp,h}: add fpsCounterTick() for FPS profiling
Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- gui/Player.cpp 1 Jul 2007 10:54:00 -0000 1.57
+++ gui/Player.cpp 2 Jul 2007 18:32:53 -0000 1.58
@@ -111,6 +111,9 @@
do_sound(true),
exit_timeout(0),
_movie_def(0)
+#ifdef GNASH_FPS_DEBUG
+ ,_fpsDebugTime(0.0)
+#endif
{
init();
}
@@ -218,6 +221,13 @@
_gui.reset(new NullGui(do_loop));
}
+#ifdef GNASH_FPS_DEBUG
+ if ( _fpsDebugTime )
+ {
+ log_debug(_("Activating FPS debugging every %g seconds"),
_fpsDebugTime);
+ _gui->setFpsTimerInterval(_fpsDebugTime);
+ }
+#endif // def GNASH_FPS_DEBUG
}
movie_definition*
Index: gui/Player.h
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- gui/Player.h 1 Jul 2007 10:54:00 -0000 1.11
+++ gui/Player.h 2 Jul 2007 18:32:53 -0000 1.12
@@ -81,6 +81,21 @@
// milliseconds per frame
void setDelay(unsigned int d) { delay=d; }
+#ifdef GNASH_FPS_DEBUG
+ /// Set the number of seconds between FPS debugging prints
+ //
+ /// @param time
+ /// Number of seconds between FPS debugging prints.
+ /// A value of 0 disables FPS printing.
+ /// A negative value results in an assertion failure.
+ ///
+ void setFpsPrintTime(float time)
+ {
+ assert(time >= 0.0);
+ _fpsDebugTime=time;
+ }
+#endif // def GNASH_FPS_DEBUG
+
void setWidth(size_t w) { width=w; }
size_t getWidth() { return width; }
@@ -178,6 +193,10 @@
/// on failure.
///
movie_definition* load_movie();
+
+#ifdef GNASH_FPS_DEBUG
+ float _fpsDebugTime;
+#endif
};
Index: gui/gnash.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gnash.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -b -r1.78 -r1.79
--- gui/gnash.cpp 2 Jul 2007 09:34:50 -0000 1.78
+++ gui/gnash.cpp 2 Jul 2007 18:32:53 -0000 1.79
@@ -78,7 +78,12 @@
static void
usage()
{
- printf("%s%s%s%s%s%s%s%s", _(
+#ifdef GNASH_FPS_DEBUG
+ printf("%s%s%s%s%s%s%s%s%s",
+#else
+ printf("%s%s%s%s%s%s%s%s",
+#endif
+ _(
"usage: gnash [options] movie_file.swf\n"
"\n"
"Plays a SWF (Shockwave Flash) movie\n"
@@ -124,6 +129,10 @@
" -P <param> Set parameter (ie. \"FlashVars=A=1&b=2\")\n"
" -V, --version Print gnash's version number and exit\n"
), _(
+#ifdef GNASH_FPS_DEBUG
+ " -f num Print FPS every num seconds (float)."
+ ), _(
+#endif // def GNASH_FPS_DEBUG
"\n"
"keys:\n"
" CTRL-Q, CTRL-W, ESC Quit/Exit\n"
@@ -195,7 +204,7 @@
}
}
- while ((c = getopt (argc, argv, "hvaps:cd:x:r:t:b:1wj:k:u:P:U:g:V")) != -1)
+ while ((c = getopt (argc, argv, "hvaps:cd:x:r:t:b:1wj:k:u:P:U:g:Vf:")) !=
-1)
{
switch (c) {
// case 'c' (Disable SDL core dumps) is decoded in sdl.cpp:init()
@@ -319,6 +328,17 @@
player.setBitDepth(bit_depth);
break;
}
+ case 'f':
+ {
+#ifdef GNASH_FPS_DEBUG
+ unsigned int frames=atoi(optarg);
+ player.setFpsPrintTime(frames);
+ break;
+#else // ndef GNASH_FPS_DEBUG
+ printf("FPS debugging disabled at compile time, -f is
invalid\n");
+ exit(EXIT_FAILURE);
+#endif // ndef GNASH_FPS_DEBUG
+ }
case 'P':
string param = optarg;
size_t eq = param.find("=");
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -b -r1.82 -r1.83
--- gui/gui.cpp 2 Jul 2007 17:17:02 -0000 1.82
+++ gui/gui.cpp 2 Jul 2007 18:32:53 -0000 1.83
@@ -31,7 +31,7 @@
#include "VM.h"
#ifdef GNASH_FPS_DEBUG
-#include "tu_timer.cpp"
+#include "tu_timer.h"
#endif
#include <cstdio>
@@ -82,6 +82,12 @@
_renderer(NULL),
_redraw_flag(true),
_stopped(false)
+#ifdef GNASH_FPS_DEBUG
+ ,fps_counter(0)
+ ,fps_counter_total(0)
+ ,fps_timer(0)
+ ,fps_timer_interval(0.0)
+#endif
{
// GNASH_REPORT_FUNCTION;
}
@@ -102,7 +108,8 @@
#ifdef GNASH_FPS_DEBUG
,fps_counter(0)
,fps_counter_total(0)
- ,fps_timer(0.0)
+ ,fps_timer(0)
+ ,fps_timer_interval(0.0)
#endif
{
}
@@ -111,6 +118,9 @@
{
// GNASH_REPORT_FUNCTION;
delete _renderer;
+#ifdef GNASH_FPS_DEBUG
+ printf("Total frame advances: %u\n", fps_counter_total);
+#endif
}
void
@@ -463,7 +473,7 @@
gnash::movie_root* m = gnash::get_current_root();
#ifdef GNASH_FPS_DEBUG
- gui->fpsCounterTick(1.0); // <-- will be based on cmd.line settings
+ gui->fpsCounterTick(); // will be a no-op if fps_timer_interval is zero
#endif
// Define REVIEW_ALL_FRAMES to have *all* frames
@@ -561,20 +571,30 @@
#ifdef GNASH_FPS_DEBUG
void
-Gui::fpsCounterTick(float interval)
+Gui::fpsCounterTick()
{
+ GNASH_REPORT_FUNCTION;
+
+ // increment this *before* the early return so that
+ // frame count on exit is still valid
+ ++fps_counter_total;
+
+ if ( ! fps_timer_interval )
+ {
+ return;
+ }
+
uint64_t current_timer = tu_timer::get_ticks();
- uint64_t interval_ms = (int)(interval * 1000.0);
+ uint64_t interval_ms = (uint64_t)(fps_timer_interval * 1000.0);
- fps_counter++;
- fps_counter_total++;
+ ++fps_counter;
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",
+ printf("Effective frame rate: %0.2f fps (%u frames total)\n",
(float)(fps_counter/secs), fps_counter_total);
fps_counter = 0;
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- gui/gui.h 2 Jul 2007 17:17:02 -0000 1.54
+++ gui/gui.h 2 Jul 2007 18:32:53 -0000 1.55
@@ -246,6 +246,18 @@
void menu_toggle_sound();
/// @}
+#ifdef GNASH_FPS_DEBUG
+ /// Set the interval between FPS debugging prints
+ //
+ /// See fpsCounterTick()
+ ///
+ void setFpsTimerInterval(float interval)
+ {
+ assert(interval >= 0.0);
+ fps_timer_interval = interval;
+ }
+#endif // def GNASH_FPS_DEBUG
+
protected:
/// Determines if playback should restart after the movie ends.
bool _loop;
@@ -286,14 +298,28 @@
#ifdef GNASH_FPS_DEBUG
unsigned int fps_counter;
+
+ // Number of calls to fpsCounterTick, which is also
+ // the number of calls to movie_advance()
unsigned int fps_counter_total;
+
uint64_t fps_timer;
- void fpsCounterTick(float interval);
+ /// The time, in seconds, between prints (which also resets the fps
counter).
+ //
+ /// interval must be >= 0
+ ///
+ float fps_timer_interval;
+
+ /// \brief
/// 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
+ /// by mouse events).
+ //
+ /// Based on fps-timer_interval. See setFpsTimerInterval.
+ ///
+ void fpsCounterTick();
+
+#endif // def GNASH_FPS_DEBUG
};
- [Gnash-commit] gnash ChangeLog gui/Player.cpp gui/Player.h gui...,
Sandro Santilli <=