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 libbase/GC.cpp libb...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog gui/gui.cpp libbase/GC.cpp libb...
Date: Wed, 05 Mar 2008 11:42:36 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/03/05 11:42:36

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

Log message:
                * libbase/GC.{cpp,h}: add a countCollectables() method for 
stats.
                * gui/gui.cpp: print collectables count in the movie properties
                  menu.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5808&r2=1.5809
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.132&r2=1.133
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/GC.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/GC.h?cvsroot=gnash&r1=1.18&r2=1.19

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5808
retrieving revision 1.5809
diff -u -b -r1.5808 -r1.5809
--- ChangeLog   5 Mar 2008 11:38:40 -0000       1.5808
+++ ChangeLog   5 Mar 2008 11:42:35 -0000       1.5809
@@ -1,3 +1,9 @@
+2008-03-04 Sandro Santilli <address@hidden>
+
+       * libbase/GC.{cpp,h}: add a countCollectables() method for stats.
+       * gui/gui.cpp: print collectables count in the movie properties
+         menu.
+
 2008-03-04 Bastiaan Jacques <address@hidden>
 
        * server/array.h server/dlist.cpp server/URLAccessManager.cpp: More

Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -b -r1.132 -r1.133
--- gui/gui.cpp 19 Feb 2008 19:20:49 -0000      1.132
+++ gui/gui.cpp 5 Mar 2008 11:42:36 -0000       1.133
@@ -902,6 +902,20 @@
        ret->insert(ret->begin(), StringPair("Dragging character: ", ss.str()));
     }
 
+    GC::CollectablesCount cc;
+    GC::get().countCollectables(cc);
+    // TODO: print sorted by value
+    std::string lbl = "GC managed ";
+    for (GC::CollectablesCount::iterator i=cc.begin(), e=cc.end(); i!=e; ++i)
+    {
+        const std::string& typ = i->first;
+        unsigned int c = i->second;
+        char buf[32];
+        snprintf(buf, 31, "%u", c);
+        buf[31] = '\0';
+        ret->insert(ret->begin(), StringPair(lbl+typ, std::string(buf)));
+    }
+
     return ret;
 }
 

Index: libbase/GC.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/GC.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- libbase/GC.cpp      5 Mar 2008 03:55:52 -0000       1.10
+++ libbase/GC.cpp      5 Mar 2008 11:42:36 -0000       1.11
@@ -142,6 +142,17 @@
        _lastResCount = _resList.size();
 }
 
+void
+GC::countCollectables(CollectablesCount& count) const
+{
+       for (ResList::const_iterator i=_resList.begin(), e=_resList.end(); 
i!=e; ++i)
+       {
+               const GcResource* res = *i;
+               std::string type = typeName(*res);
+               count[type]++;
+       }
+}
+
 } // end of namespace gnash
 
 

Index: libbase/GC.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/GC.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- libbase/GC.h        21 Jan 2008 20:55:43 -0000      1.18
+++ libbase/GC.h        5 Mar 2008 11:42:36 -0000       1.19
@@ -24,6 +24,8 @@
 #endif
 
 #include <list>
+#include <map>
+#include <string>
 #include <algorithm> //for std::find
 
 #ifndef NDEBUG
@@ -245,12 +247,17 @@
        ///
        void collect();
 
+       typedef std::map<std::string, unsigned int> CollectablesCount;
+
+       /// Count collectables
+       void countCollectables(CollectablesCount& count) const;
+
 private:
 
        /// Number of newly registered collectable since last collection run
        /// triggering next collection.
        /// Should be made a parameter ?
-       static const unsigned int maxNewCollectablesCount = 10;
+       static const unsigned int maxNewCollectablesCount = 50;
 
        /// Create a garbage collector, using the given root
        GC(GcRoot& root)




reply via email to

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