[arch-commits] Commit in kdebase-runtime/kde-unstable (2 files)

Andrea Scarpino andrea at archlinux.org
Tue Jul 12 16:18:53 EDT 2011


    Date: Tuesday, July 12, 2011 @ 16:18:53
  Author: andrea
Revision: 131357

Fix high CPU usage by nepomukservicestub BUG#276593

Added:
  kdebase-runtime/kde-unstable/fix-nepomuk-cpu-usage.patch
Modified:
  kdebase-runtime/kde-unstable/PKGBUILD

-----------------------------+
 PKGBUILD                    |   12 ++-
 fix-nepomuk-cpu-usage.patch |  133 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 141 insertions(+), 4 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2011-07-12 19:27:26 UTC (rev 131356)
+++ PKGBUILD	2011-07-12 20:18:53 UTC (rev 131357)
@@ -3,7 +3,6 @@
 # Contributor: Pierre Schmitz <pierre at archlinux.de>
 
 pkgname=kdebase-runtime
-_pkgname=kde-runtime
 pkgver=4.6.95
 pkgrel=1
 pkgdesc="KDE Base Runtime Environment"
@@ -17,14 +16,19 @@
             'rarian: needed by khelpcenter'
             'gdb: drkonq crash handler')
 install="${pkgname}.install"
-source=("http://download.kde.org/unstable/${pkgver}/src/${_pkgname}-${pkgver}.tar.bz2")
-sha1sums=('8782bca0ca5afae9c600cc29346968669b940251')
+source=("http://download.kde.org/unstable/${pkgver}/src/kde-runtime-${pkgver}.tar.bz2"
+        'fix-nepomuk-cpu-usage.patch')
+sha1sums=('8782bca0ca5afae9c600cc29346968669b940251'
+          'dcddfd7b3191597edaaab93d358e6ff87c53a627')
 
 build() {
+    cd "${srcdir}"/kde-runtime-${pkgver}
+    patch -p1 -i "${srcdir}"/fix-nepomuk-cpu-usage.patch
+
     cd "${srcdir}"
 	mkdir build
 	cd build
-	cmake ../${_pkgname}-${pkgver} \
+	cmake ../kde-runtime-${pkgver} \
 		-DCMAKE_BUILD_TYPE=Release \
 		-DCMAKE_SKIP_RPATH=ON \
 		-DCMAKE_INSTALL_PREFIX=/usr

Added: fix-nepomuk-cpu-usage.patch
===================================================================
--- fix-nepomuk-cpu-usage.patch	                        (rev 0)
+++ fix-nepomuk-cpu-usage.patch	2011-07-12 20:18:53 UTC (rev 131357)
@@ -0,0 +1,133 @@
+commit 327ec9a67af653467b670115ebb3e26b00183c1d
+Author: Sebastian Trueg <trueg at kde.org>
+Date:   Thu Jul 7 17:33:23 2011 +0200
+
+    Throttle the IndexCleaner the same way we do with the IndexScheduler.
+    
+    BUG: 276593
+
+diff --git a/nepomuk/services/strigi/indexcleaner.cpp b/nepomuk/services/strigi/indexcleaner.cpp
+index 5c604ab..9198d0b 100644
+--- a/nepomuk/services/strigi/indexcleaner.cpp
++++ b/nepomuk/services/strigi/indexcleaner.cpp
+@@ -47,7 +47,8 @@ using namespace Soprano::Vocabulary;
+ 
+ 
+ Nepomuk::IndexCleaner::IndexCleaner(QObject* parent)
+-    : KJob(parent)
++    : KJob(parent),
++      m_delay(0)
+ {
+     setCapabilities( Suspendable );
+ }
+@@ -268,7 +269,7 @@ void Nepomuk::IndexCleaner::slotRemoveResourcesDone(KJob* job)
+ 
+     QMutexLocker lock(&m_stateMutex);
+     if( !m_suspended ) {
+-        clearNextBatch();
++        QTimer::singleShot(m_delay, this, SLOT(clearNextBatch()));
+     }
+ }
+ 
+@@ -313,4 +314,9 @@ bool Nepomuk::IndexCleaner::doResume()
+     return true;
+ }
+ 
++void Nepomuk::IndexCleaner::setDelay(int msecs)
++{
++    m_delay = msecs;
++}
++
+ #include "indexcleaner.moc"
+diff --git a/nepomuk/services/strigi/indexcleaner.h b/nepomuk/services/strigi/indexcleaner.h
+index e1c38ca..bf0713e 100644
+--- a/nepomuk/services/strigi/indexcleaner.h
++++ b/nepomuk/services/strigi/indexcleaner.h
+@@ -41,6 +41,16 @@ namespace Nepomuk {
+         virtual bool doSuspend();
+         virtual bool doResume();
+ 
++    public slots:
++        /**
++         * Set the delay between the cleanup queries.
++         * Used for throtteling the cleaner to not grab too
++         * many resources. Default is 0.
++         *
++         * \sa IndexScheduler::setIndexingSpeed()
++         */
++        void setDelay(int msecs);
++
+     private slots:
+         void clearNextBatch();
+         void slotRemoveResourcesDone(KJob* job);
+@@ -52,6 +62,7 @@ namespace Nepomuk {
+ 
+         QMutex m_stateMutex;
+         bool m_suspended;
++        int m_delay;
+     };
+ }
+ 
+diff --git a/nepomuk/services/strigi/indexscheduler.cpp b/nepomuk/services/strigi/indexscheduler.cpp
+index 3c92657..f3c6c36 100644
+--- a/nepomuk/services/strigi/indexscheduler.cpp
++++ b/nepomuk/services/strigi/indexscheduler.cpp
+@@ -208,7 +208,7 @@ Nepomuk::IndexScheduler::IndexScheduler( QObject* parent )
+     : QObject( parent ),
+       m_suspended( false ),
+       m_indexing( false ),
+-      m_speed( FullSpeed )
++      m_indexingDelay( 0 )
+ {
+     m_cleaner = new IndexCleaner(this);
+     connect( m_cleaner, SIGNAL(finished(KJob*)), this, SLOT(slotCleaningDone()) );
+@@ -266,7 +266,13 @@ void Nepomuk::IndexScheduler::setSuspended( bool suspended )
+ void Nepomuk::IndexScheduler::setIndexingSpeed( IndexingSpeed speed )
+ {
+     kDebug() << speed;
+-    m_speed = speed;
++    m_indexingDelay = 0;
++    if ( speed != FullSpeed ) {
++        m_indexingDelay = (speed == ReducedSpeed) ? s_reducedSpeedDelay : s_snailPaceDelay;
++    }
++    if( m_cleaner ) {
++        m_cleaner->setDelay(m_indexingDelay);
++    }
+ }
+ 
+ 
+@@ -481,11 +487,7 @@ bool Nepomuk::IndexScheduler::analyzeDir( const QString& dir_, Nepomuk::IndexSch
+ void Nepomuk::IndexScheduler::callDoIndexing()
+ {
+     if( !m_suspended ) {
+-        uint delay = 0;
+-        if ( m_speed != FullSpeed ) {
+-            delay = (m_speed == ReducedSpeed) ? s_reducedSpeedDelay : s_snailPaceDelay;
+-        }
+-        QTimer::singleShot( delay, this, SLOT(doIndexing()) );
++        QTimer::singleShot( m_indexingDelay, this, SLOT(doIndexing()) );
+     }
+ }
+ 
+diff --git a/nepomuk/services/strigi/indexscheduler.h b/nepomuk/services/strigi/indexscheduler.h
+index 9ae1f18..8756206 100644
+--- a/nepomuk/services/strigi/indexscheduler.h
++++ b/nepomuk/services/strigi/indexscheduler.h
+@@ -121,8 +121,6 @@ namespace Nepomuk {
+             SnailPace
+         };
+ 
+-        IndexingSpeed currentSpeed() const { return m_speed; }
+-
+     public Q_SLOTS:
+         void suspend();
+         void resume();
+@@ -226,7 +224,7 @@ namespace Nepomuk {
+         QString m_currentFolder;
+         KUrl m_currentUrl;
+ 
+-        IndexingSpeed m_speed;
++        int m_indexingDelay;
+         IndexCleaner* m_cleaner;
+     };
+ 



More information about the arch-commits mailing list