gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog gui/NullGui.cpp libbase/Makefil...


From: Markus Gothe
Subject: [Gnash-commit] gnash ChangeLog gui/NullGui.cpp libbase/Makefil...
Date: Thu, 13 Sep 2007 01:12:20 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Markus Gothe <nihilus>  07/09/13 01:12:20

Modified files:
        .              : ChangeLog 
        gui            : NullGui.cpp 
        libbase        : Makefile.am triangulate_impl.h 
        utilities      : processor.cpp 
        server         : timers.h 
        server/asobj   : NetStream.h NetStreamFfmpeg.cpp 
        server/vm      : VM.cpp 
Removed files:
        libbase        : tu_timer.cpp tu_timer.h 

Log message:
        Replaced inappropiate use of tu_timer/gettimeofday with std::clock and
        boost/timer.hpp where appropiate. Might break things, but I think this 
is
        the way to fix it. :)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4298&r2=1.4299
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/NullGui.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/Makefile.am?cvsroot=gnash&r1=1.80&r2=1.81
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/triangulate_impl.h?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/tu_timer.cpp?cvsroot=gnash&r1=1.11&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/tu_timer.h?cvsroot=gnash&r1=1.6&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/processor.cpp?cvsroot=gnash&r1=1.63&r2=1.64
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.h?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.h?cvsroot=gnash&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&r1=1.90&r2=1.91
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.cpp?cvsroot=gnash&r1=1.16&r2=1.17

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4298
retrieving revision 1.4299
diff -u -b -r1.4298 -r1.4299
--- ChangeLog   12 Sep 2007 17:15:11 -0000      1.4298
+++ ChangeLog   13 Sep 2007 01:12:18 -0000      1.4299
@@ -1,3 +1,16 @@
+2007-09-13 Markus Gothe <address@hidden>
+
+       * gui/NullGui.cpp libbase/Makefile.am libbase/triangulate_impl.h 
+       server/timers.h server/asobj/NetStream.h 
+       server/asobj/NetStreamFfmpeg.cpp 
+       server/vm/VM.cpp utilities/processor.cpp
+       
+       * Removed Files:
+        libbase/tu_timer.cpp libbase/tu_timer.h
+
+       Overhauled tu_timer with the se of std::clock and boost/timer.hpp.
+       Might, break things, but it better get fixed this way.
+
 2007-09-12 Sandro Santilli <address@hidden>
 
        * testsuite/actionscript.all/Inheritance.as: more tests for 'super'.

Index: gui/NullGui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/NullGui.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- gui/NullGui.cpp     9 Jul 2007 12:12:16 -0000       1.16
+++ gui/NullGui.cpp     13 Sep 2007 01:12:19 -0000      1.17
@@ -32,7 +32,8 @@
 # include <unistd.h> // for usleep
 #endif
 
-#include "tu_timer.h"
+#include <boost/timer.hpp>
+using boost::timer;
 
 namespace gnash
 {
@@ -40,27 +41,27 @@
 bool
 NullGui::run()
 {
-  uint64_t prevtimer=0;
-  uint64_t start_timer = tu_timer::get_ticks();  // returns milliseconds
+  timer prevtimer;
+  timer start_timer;  // returns milliseconds
 
   prevtimer = start_timer;
 
   while (true)
   {
   
-    uint64_t timer=0;
+    timer timer;
 
     // synchronize to frame time 
     if (_timeout || (_interval>1))  // avoid timing completely for interval==1
     while (1) 
     {
         
-      timer = tu_timer::get_ticks();
+      timer.restart();
             
-      if (timer - prevtimer >= _interval)
+      if (timer.elapsed_min() - prevtimer.elapsed() >= _interval)
         break; // next frame, please!
     
-      if (timer < prevtimer) // time glitch protection
+      if (timer.elapsed() < prevtimer.elapsed()) // time glitch protection
         prevtimer = timer;
         
       usleep(1);
@@ -69,7 +70,7 @@
     
     if ( _timeout )
     {
-      if ( timer - start_timer > _timeout)
+      if ( timer.elapsed() - start_timer.elapsed() > _timeout)
       {
         break;
       }

Index: libbase/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/libbase/Makefile.am,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -b -r1.80 -r1.81
--- libbase/Makefile.am 10 Sep 2007 11:22:53 -0000      1.80
+++ libbase/Makefile.am 13 Sep 2007 01:12:19 -0000      1.81
@@ -94,7 +94,6 @@
        tu_file.cpp \
        $(SDL_FILE) \
        tu_random.cpp \
-       tu_timer.cpp \
        tu_types.cpp \
        utf8.cpp \
        utility.cpp \
@@ -138,7 +137,6 @@
        tu_opengl_includes.h \
        tu_random.h \
        tu_swap.h \
-       tu_timer.h \
        tu_types.h \
        utf8.h \
        utility.h \

Index: libbase/triangulate_impl.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/triangulate_impl.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- libbase/triangulate_impl.h  15 Jun 2007 18:26:25 -0000      1.24
+++ libbase/triangulate_impl.h  13 Sep 2007 01:12:19 -0000      1.25
@@ -24,7 +24,7 @@
 // code, see the FIST web page at:
 // http://www.cosy.sbg.ac.at/~held/projects/triang/triang.html
 
-/* $Id: triangulate_impl.h,v 1.24 2007/06/15 18:26:25 strk Exp $ */
+/* $Id: triangulate_impl.h,v 1.25 2007/09/13 01:12:19 nihilus Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -38,7 +38,8 @@
 
 #define PROFILE_TRIANGULATE
 #ifdef PROFILE_TRIANGULATE
-#include "tu_timer.h"
+#include <boost/timer.hpp>
+using boost::timer;
 #endif // PROFILE_TRIANGULATE
 
 // Template this whole thing on coord_t, so int16_t and float versions
@@ -2226,7 +2227,7 @@
        }
 
 #ifdef PROFILE_TRIANGULATE
-       uint64_t        start_ticks = tu_timer::get_profile_ticks();
+       timer start;
 #endif // PROFILE_TRIANGULATE
 
        // Local generator, for some parts of the algo that need random numbers.
@@ -2248,8 +2249,8 @@
        }
 
 #ifdef PROFILE_TRIANGULATE
-       uint64_t        join_ticks = tu_timer::get_profile_ticks();
-       fprintf(stderr, "join poly = %1.6f sec\n", 
tu_timer::profile_ticks_to_seconds(join_ticks - start_ticks));
+       fprintf(stderr, "join poly = %1.6f sec\n", start.elapsed());
+       timer join;
 #endif // PROFILE_TRIANGULATE
 
 // Debugging only: dump coords of joined poly.
@@ -2381,12 +2382,12 @@
        }
        
 #ifdef PROFILE_TRIANGULATE
-       uint64_t        clip_ticks = tu_timer::get_profile_ticks();
-       fprintf(stderr, "clip poly = %1.6f sec\n", 
tu_timer::profile_ticks_to_seconds(clip_ticks - join_ticks));
-       fprintf(stderr, "total for poly = %1.6f sec\n", 
tu_timer::profile_ticks_to_seconds(clip_ticks - start_ticks));
+       timer clip;
+       fprintf(stderr, "clip poly = %1.6f sec\n", (clip.elapsed_min() - 
join.elapsed()));
+       fprintf(stderr, "total for poly = %1.6f sec\n", (clip.elapsed_min() - 
start.elapsed()));
        fprintf(stderr, "vert count = %d, verts clipped / sec = %f\n",
                input_vert_count,
-               input_vert_count / 
tu_timer::profile_ticks_to_seconds(clip_ticks - join_ticks));
+               input_vert_count / (clip.elapsed_min() - join.elapsed()));
 #endif // PROFILE_TRIANGULATE
 
        assert(penv.m_polys.size() == 0);

Index: utilities/processor.cpp
===================================================================
RCS file: /sources/gnash/gnash/utilities/processor.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- utilities/processor.cpp     7 Sep 2007 00:11:27 -0000       1.63
+++ utilities/processor.cpp     13 Sep 2007 01:12:20 -0000      1.64
@@ -43,6 +43,9 @@
 #include "debugger.h"
 #include "VM.h"
 
+#include <boost/timer.hpp>
+using boost::timer;
+
 extern "C"{
        #include <unistd.h>
 #ifdef HAVE_GETOPT_H
@@ -116,21 +119,18 @@
 // How many time do we allow to hit the end ?
 static size_t allowed_end_hits = 1;
 
-double lastAdvanceTimer;
+timer lastAdvanceTimer;
 
 void
 resetLastAdvanceTimer()
 {
-       using namespace tu_timer;
-       lastAdvanceTimer = ticks_to_seconds(get_ticks());
+       lastAdvanceTimer.restart();
 }
 
 double
 secondsSinceLastAdvance()
 {
-       using namespace tu_timer;
-       double now = ticks_to_seconds(get_ticks());
-       return ( now - lastAdvanceTimer);
+       return (lastAdvanceTimer.elapsed());
 }
 
 int

Index: server/timers.h
===================================================================
RCS file: /sources/gnash/gnash/server/timers.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- server/timers.h     2 Jul 2007 03:20:34 -0000       1.25
+++ server/timers.h     13 Sep 2007 01:12:20 -0000      1.26
@@ -31,7 +31,8 @@
 #include "as_function.h" // for visibility of destructor by intrusive_ptr
 #include "smart_ptr.h"
 
-#include "tu_timer.h"
+#include <boost/timer.hpp>
+using boost::timer;
 
 #include <string>
 

Index: server/asobj/NetStream.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- server/asobj/NetStream.h    3 Aug 2007 20:54:47 -0000       1.48
+++ server/asobj/NetStream.h    13 Sep 2007 01:12:20 -0000      1.49
@@ -19,7 +19,7 @@
 //
 //
 
-/*  $Id: NetStream.h,v 1.48 2007/08/03 20:54:47 strk Exp $ */
+/*  $Id: NetStream.h,v 1.49 2007/09/13 01:12:20 nihilus Exp $ */
 
 #ifndef __NETSTREAM_H__
 #define __NETSTREAM_H__
@@ -187,9 +187,9 @@
 public:
 
        NetStream();
-
+#if defined(USE_FFMEPG) || defined(SOUND_GST)
        virtual ~NetStream(){}
-
+#endif
        /// Closes the video session and frees all ressources used for decoding
        /// except the FLV-parser (this might not be correct).
        virtual void close(){}

Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -b -r1.90 -r1.91
--- server/asobj/NetStreamFfmpeg.cpp    10 Sep 2007 16:53:30 -0000      1.90
+++ server/asobj/NetStreamFfmpeg.cpp    13 Sep 2007 01:12:20 -0000      1.91
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: NetStreamFfmpeg.cpp,v 1.90 2007/09/10 16:53:30 strk Exp $ */
+/* $Id: NetStreamFfmpeg.cpp,v 1.91 2007/09/13 01:12:20 nihilus Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -36,7 +36,7 @@
 #include "embedVideoDecoderFfmpeg.h"
 
 #include <boost/scoped_array.hpp>
-
+#include <ctime>
 
 #if defined(_WIN32) || defined(WIN32)
 # include <windows.h>  // for sleep()
@@ -635,7 +635,7 @@
        ns->m_last_audio_timestamp = 0;
        ns->m_current_timestamp = 0;
 
-       ns->m_start_clock = tu_timer::get_ticks();
+       ns->m_start_clock = std::clock();
 
        ns->m_unqueued_data = NULL;
 
@@ -1033,7 +1033,7 @@
                m_last_audio_timestamp = 0;
                m_current_timestamp = 0;
 
-               m_start_clock = tu_timer::get_ticks();
+               m_start_clock = std::clock();
 
        } else if (m_isFLV) {
 
@@ -1106,7 +1106,7 @@
                if (m_ACodecCtx && get_sound_handler()) {
                        current_clock = m_current_timestamp;
                } else {
-                       current_clock = tu_timer::get_ticks() - m_start_clock;
+                       current_clock = std::clock() - m_start_clock;
                        m_current_timestamp = current_clock;
                }
 
@@ -1198,7 +1198,7 @@
        m_pause = true;
 
        // Save the current time so we later can tell how long the pause lasted
-       m_time_of_pause = tu_timer::get_ticks();
+       m_time_of_pause = std::clock();
 }
 
 void NetStreamFfmpeg::unpausePlayback()
@@ -1211,11 +1211,11 @@
        m_pause = false;        
 
        if (m_current_timestamp == 0) {
-               m_start_clock = tu_timer::get_ticks();
+               m_start_clock = std::clock();
        } else {
                // Add the paused time to the start time so that the playhead 
doesn't
                // noticed that we have been paused
-               m_start_clock += tu_timer::get_ticks() - m_time_of_pause;
+               m_start_clock += std::clock() - m_time_of_pause;
        }
 
        // Re-connect to the soundhandler.

Index: server/vm/VM.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/VM.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/vm/VM.cpp    7 Sep 2007 00:11:26 -0000       1.16
+++ server/vm/VM.cpp    13 Sep 2007 01:12:20 -0000      1.17
@@ -16,7 +16,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: VM.cpp,v 1.16 2007/09/07 00:11:26 strk Exp $ */
+/* $Id: VM.cpp,v 1.17 2007/09/13 01:12:20 nihilus Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -27,7 +27,7 @@
 #include "movie_instance.h"
 #include "movie_root.h"
 #include "Global.h"
-#include "tu_timer.h" // for tu_timer::get_ticks()
+#include <ctime> // for std::clocks()
 #include "rc.h" //for overriding default version string with rcfile
 
 #include <memory>
@@ -75,7 +75,7 @@
        :
        _root_movie(new movie_root()),
        _swfversion(topmovie.get_version()),
-       _start_time(tu_timer::get_ticks())
+       _start_time(std::clock())
 {
 }
 
@@ -134,7 +134,7 @@
 uint64_t
 VM::getTime()
 {
-  return  (tu_timer::get_ticks() -  _start_time);
+  return  (std::clock() -  _start_time);
 }
 
 void

Index: libbase/tu_timer.cpp
===================================================================
RCS file: libbase/tu_timer.cpp
diff -N libbase/tu_timer.cpp
--- libbase/tu_timer.cpp        5 Sep 2007 00:22:34 -0000       1.11
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,107 +0,0 @@
-// tu_timer.cpp        -- by Thatcher Ulrich <address@hidden>
-
-// This source code has been donated to the Public Domain.  Do
-// whatever you want with it.
-
-// Utility/profiling timer.
-
-
-#include "tu_timer.h"
-
-
-#if defined(_WIN32) || defined(WIN32)
-
-#include <windows.h>
-#include <mmsystem.h>
-
-
-uint64_t tu_timer::get_ticks()
-{
-       return timeGetTime();
-}
-
-
-double tu_timer::ticks_to_seconds(uint64_t ticks)
-{
-       return ticks * (1.0f / 1000.f);
-}
-
-
-uint64_t       tu_timer::get_profile_ticks()
-{
-       // @@ use rdtsc?
-
-       //Nano-second timer.
-       LARGE_INTEGER   li;
-       QueryPerformanceCounter(&li);
-
-       return li.QuadPart;
-}
-
-
-double tu_timer::profile_ticks_to_seconds(uint64_t ticks)
-{
-       LARGE_INTEGER   freq;
-       QueryPerformanceFrequency(&freq);
-
-       double  seconds = (double) ticks;
-       seconds /= (double) freq.QuadPart;
-
-       return seconds;
-}
-
-
-#else  // not _WIN32
-
-
-#include <sys/time.h>
-
-
-// The profile ticks implementation is just fine for a normal timer.
-
-
-uint64_t tu_timer::get_ticks()
-{
-       return static_cast<uint64_t>(get_profile_ticks()/1000.0);
-}
-
-
-double tu_timer::ticks_to_seconds(uint64_t ticks)
-{
-       return profile_ticks_to_seconds(ticks);
-}
-
-
-uint64_t       tu_timer::get_profile_ticks()
-{
-       // @@ TODO prefer rdtsc when available?
-
-       // Return microseconds.
-       struct timeval tv;
-       
-       gettimeofday(&tv, 0);
-
-       uint64_t result = tv.tv_sec * 1000000;
-
-       result += tv.tv_usec;
-       // Time Unit: microsecond
-
-       return result;
-}
-
-
-double tu_timer::profile_ticks_to_seconds(uint64_t ticks)
-{
-       // ticks is microseconds.  Convert to seconds.
-       return ticks / 1000000.0;
-}
-
-#endif // not _WIN32
-
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 8 
-// tab-width: 8
-// indent-tabs-mode: t
-// End:

Index: libbase/tu_timer.h
===================================================================
RCS file: libbase/tu_timer.h
diff -N libbase/tu_timer.h
--- libbase/tu_timer.h  27 May 2007 14:22:04 -0000      1.6
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,46 +0,0 @@
-// tu_timer.h  -- by Thatcher Ulrich <address@hidden>
-
-// This source code has been donated to the Public Domain.  Do
-// whatever you want with it.
-
-// Utility/profiling timer.
-
-
-#ifndef TU_TIMER_H
-
-#include "tu_config.h"
-#include "tu_types.h"
-
-
-namespace tu_timer
-{
-       // General-purpose wall-clock timer.  May not be hi-res enough
-       // for profiling. Time Unit: millisecond
-       DSOEXPORT uint64_t get_ticks();
-
-       // Time Unit: second
-       DSOEXPORT double ticks_to_seconds(uint64_t ticks);
-       
-       // Hi-res timer for CPU profiling.
-
-       // Return a hi-res timer value.  Time 0 is arbitrary, so
-       // generally you want to call this at the start and end of an
-       // operation, and pass the difference to
-       // profile_ticks_to_seconds() to find out how long the
-       // operation took.
-       DSOEXPORT uint64_t      get_profile_ticks();
-
-       // Convert a hi-res ticks value into seconds.
-       DSOEXPORT double        profile_ticks_to_seconds(uint64_t 
profile_ticks);
-}
-
-
-#endif // TU_TIMER_H
-
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 8 
-// tab-width: 8
-// indent-tabs-mode: t
-// End:




reply via email to

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