[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Sun Mar 20 22:11:10 CET 2005


CVS commit by staikos: 

If compiled with benchmarking, it now dumps the count of the number of times
each plot was redrawn on exit.  With this we could develop a nice testcase to
show when we add new draws that we shouldn't have.


  M +2 -0      kst2dplot.cpp   1.384
  M +7 -0      kstdebug.cpp   1.16
  M +9 -0      kstdebug.h   1.15


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.383:1.384
@@ -37,4 +37,5 @@
 // application specific includes
 #include "kst2dplot.h"
+#include "kstdebug.h"
 #include "kstdoc.h"
 #include "kstfitdialog_i.h"
@@ -2180,4 +2181,5 @@ void Kst2DPlot::draw(QPainter &p, KstPai
 
 #ifdef BENCHMARK
+  ++KstDebug::self()->drawCounter()[tagName()];
   kdDebug() << ">>>>>>>>>>>>>>>>>>>> DRAWING PLOT " << tagName() << endl;
   QTime bench_time;

--- kdeextragear-2/kst/kst/kstdebug.cpp  #1.15:1.16
@@ -21,4 +21,5 @@
 
 #include <kapplication.h>
+#include <kdebug.h>
 #include <klocale.h>
 
@@ -45,4 +46,10 @@ KstDebug::KstDebug() {
 
 KstDebug::~KstDebug() {
+#ifdef BENCHMARK
+  kdDebug() << "DRAW COUNTS ---------------------------------------" << endl;
+  for (QMap<QString,int>::ConstIterator i = _drawCounter.begin(); i != _drawCounter.end(); ++i) {
+    kdDebug() << i.key() << ": " << i.data() << endl;
+  }
+#endif
 }
 

--- kdeextragear-2/kst/kst/kstdebug.h  #1.14:1.15
@@ -24,4 +24,5 @@
 
 #include <kstaticdeleter.h>
+#include <ksttimers.h>
 
 #include "kst_export.h"
@@ -49,4 +50,8 @@ class KST_EXPORT KstDebug : public QObje
     QString label(LogLevel level) const;
 
+#ifdef BENCHMARK
+    QMap<QString,int>& drawCounter() { return _drawCounter; }
+#endif
+
   signals: 
     void logAdded();
@@ -61,4 +66,8 @@ class KST_EXPORT KstDebug : public QObje
     int         _limit;
     QMutex _lock;
+#ifdef BENCHMARK
+    // If this is ever public we can't do this
+    QMap<QString,int> _drawCounter;
+#endif
 };
 




More information about the Kst mailing list