Version: 2.2.0 (using KDE 4.3.2) OS: Linux Installed from: Ubuntu Packages Especially on a full (re-)scan amarokcollectionscanner takes very long and slows down the whole PC (CPU & IO). amarokcolletionscanner should have high nice (nice 19) and in the best case also low IO priority (ionice -c3) to not disturb other (foreground) applications. [As the slowdown of the whole system can be somehow dramatical I set severity as "Bug" and not "Wishlist"]
Jeff, isn't this already solved in 2.2.1?
Nice value of amarokcollectionscanner is still 0 with Amarok 2.2.1 (using Gentoo ebuilds) - manually lowering the nice value of this process to 1 makes the rest of the application much more responsive while doing a full scan.
*** This bug has been confirmed by popular vote. ***
commit dd3146810a9b187e27dde7ef61461bb7fc775759 Author: Jeff Mitchell <mitchell@kde.org> Date: Wed May 12 17:55:03 2010 -0400 The collection scanner now runs with idle priority when invoked by Amarok. BUG: 212781 diff --git a/ChangeLog b/ChangeLog index 2c2165a..7ac7979 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ Amarok ChangeLog VERSION 2.3.1 CHANGES: + * The Collection scanner now runs with idle priority when invoked by + Amarok. Batch scan users can invoke it with the --idlepriority flag. BUGFIXES: * Fixed factor used when filtering lengths in collection browser. diff --git a/src/core-impl/collections/sqlcollection/ScanManager.cpp b/src/core-impl/collections/sqlcollection/ScanManager.cpp index 1d52452..664672b 100644 --- a/src/core-impl/collections/sqlcollection/ScanManager.cpp +++ b/src/core-impl/collections/sqlcollection/ScanManager.cpp @@ -124,6 +124,7 @@ ScanManager::startFullScan() if( AmarokConfig::useCharsetDetector() ) *m_scanner << "-c"; *m_scanner << "--savelocation" << KGlobal::dirs()->saveLocation( "data", QString("amarok/"), true ); + *m_scanner << "--idlepriority"; QStringList collectionFolders = m_collection->mountPointManager()->collectionFolders(); *m_scanner << collectionFolders; @@ -208,7 +209,7 @@ void ScanManager::startIncrementalScan( const QString &directory ) if( !batchfileExists || !readBatchFile( batchfileLocation ) ) { m_scanner = new AmarokProcess( this ); - *m_scanner << App::collectionScannerLocation() << "-i" << "--collectionid" << m_collection->collectionId() << "-p"; + *m_scanner << App::collectionScannerLocation() << "-i" << "--collectionid" << m_collection->collectionId() << "-p" << "--idlepriority"; if( AmarokConfig::scanRecursively() && directory.isEmpty() ) *m_scanner << "-r"; @@ -539,7 +540,7 @@ ScanManager::restartScanner() if( m_isIncremental ) { - *m_scanner << "-i" << "--collectionid" << m_collection->collectionId(); + *m_scanner << "-i" << "--collectionid" << m_collection->collectionId() << "--idlepriority"; if( pApp->isNonUniqueInstance() ) *m_scanner << "--pid" << QString::number( QApplication::applicationPid() ); } diff --git a/utilities/collectionscanner/CollectionScanner.cpp b/utilities/collectionscanner/CollectionScanner.cpp index e79ffee..bf85dc3 100644 --- a/utilities/collectionscanner/CollectionScanner.cpp +++ b/utilities/collectionscanner/CollectionScanner.cpp @@ -43,6 +43,7 @@ #include <QTextStream> #include <QTime> #include <QTimer> +#include <QThread> //Taglib: #include <apetag.h> @@ -94,12 +95,19 @@ CollectionScanner::CollectionScanner( int &argc, char **argv ) , m_recursively( false ) , m_incremental( false ) , m_restart( false ) + , m_idlePriority( false ) , m_amarokCollectionInterface( 0 ) { setObjectName( "amarokcollectionscanner" ); readArgs(); + if( m_idlePriority ) + { + if( QThread::currentThread() ) + QThread::currentThread()->setPriority( QThread::IdlePriority ); + } + TagLib::FileRef::addFileTypeResolver(new RealMediaFileTypeResolver); TagLib::FileRef::addFileTypeResolver(new AudibleFileTypeResolver); TagLib::FileRef::addFileTypeResolver(new ASFFileTypeResolver); @@ -963,6 +971,8 @@ CollectionScanner::readArgs() m_importPlaylists = true; else if( myarg == "restart" ) m_restart = true; + else if( myarg == "idlepriority" ) + m_idlePriority = true; else if( myarg == "batch" ) m_batch = true; else if( myarg == "charset" ) @@ -1034,6 +1044,7 @@ CollectionScanner::displayHelp() s_textStream << qPrintable( tr( "-p, --importplaylists : Import playlists" ) ) << endl; s_textStream << qPrintable( tr( "-s, --restart : After a crash, restart the scanner in its last position" ) ) << endl; s_textStream << qPrintable( tr( "-b, --batch : Run in batch mode" ) ) << endl; + s_textStream << qPrintable( tr( "--idlepriority : Run at idle priority" ) ) << endl; s_textStream << qPrintable( tr( "--rpath=\"<path>\" : In full-scan batch mode, specifies a path to prepend to entries (default is the current directory)" ) ) << endl; s_textStream << qPrintable( tr( "--savelocation : Internal command used by Amarok" ) ) << endl; s_textStream.flush(); diff --git a/utilities/collectionscanner/CollectionScanner.h b/utilities/collectionscanner/CollectionScanner.h index 253b28f..494ece8 100644 --- a/utilities/collectionscanner/CollectionScanner.h +++ b/utilities/collectionscanner/CollectionScanner.h @@ -120,6 +120,7 @@ private: bool m_recursively; bool m_incremental; bool m_restart; + bool m_idlePriority; QString m_saveLocation; QString m_logfile; QString m_rpath;