mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-19 12:21:52 +02:00
Add more specialized SQL debugging
This commit is contained in:
@@ -51,7 +51,7 @@ Database::Database( const QString& dbname, QObject* parent )
|
||||
else
|
||||
m_maxConcurrentThreads = qBound( DEFAULT_WORKER_THREADS, QThread::idealThreadCount(), MAX_WORKER_THREADS );
|
||||
|
||||
tDebug() << Q_FUNC_INFO << "Using" << m_maxConcurrentThreads << "database worker threads";
|
||||
tDebug() << Q_FUNC_INFO << "Using" << m_maxConcurrentThreads << "database worker threads; current (GUI) thread is " << QThread::currentThread();
|
||||
|
||||
connect( m_impl, SIGNAL( indexReady() ), SIGNAL( indexReady() ) );
|
||||
connect( m_impl, SIGNAL( indexReady() ), SIGNAL( ready() ) );
|
||||
@@ -142,6 +142,7 @@ Database::impl()
|
||||
QThread* thread = QThread::currentThread();
|
||||
if ( !m_implHash.contains( thread ) )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "Creating database impl for thread " << QThread::currentThread();
|
||||
DatabaseImpl* impl = m_impl->clone();
|
||||
m_implHash.insert( thread, impl );
|
||||
}
|
||||
|
@@ -63,6 +63,13 @@ TomahawkSqlQuery::exec( const QString& query )
|
||||
bool
|
||||
TomahawkSqlQuery::exec()
|
||||
{
|
||||
bool log = false;
|
||||
#ifdef TOMAHAWK_QUERY_ANALYZE
|
||||
log = true;
|
||||
#endif
|
||||
if ( log )
|
||||
tLog( LOGSQL ) << "TomahawkSqlQuery::exec running in thread " << QThread::currentThread();
|
||||
|
||||
QTime t;
|
||||
t.start();
|
||||
|
||||
@@ -81,14 +88,9 @@ TomahawkSqlQuery::exec()
|
||||
showError();
|
||||
|
||||
int e = t.elapsed();
|
||||
bool log = ( e >= QUERY_THRESHOLD );
|
||||
|
||||
#ifdef TOMAHAWK_QUERY_ANALYZE
|
||||
log = true;
|
||||
#endif
|
||||
|
||||
if ( log )
|
||||
tLog( LOGSQL ) << "TomahawkSqlQuery (" << t.elapsed() << "ms ):" << lastQuery();
|
||||
if ( log || e >= QUERY_THRESHOLD )
|
||||
tLog( LOGSQL ) << "TomahawkSqlQuery::exec (" << t.elapsed() << "ms ):" << lastQuery();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -97,6 +99,13 @@ TomahawkSqlQuery::exec()
|
||||
bool
|
||||
TomahawkSqlQuery::commitTransaction()
|
||||
{
|
||||
bool log = false;
|
||||
#ifdef TOMAHAWK_QUERY_ANALYZE
|
||||
log = true;
|
||||
#endif
|
||||
if ( log )
|
||||
tLog( LOGSQL ) << "TomahawkSqlQuery::commitTransaction running in thread " << QThread::currentThread();
|
||||
|
||||
unsigned int retries = 0;
|
||||
while ( !m_db.commit() && ++retries < 10 )
|
||||
{
|
||||
|
Reference in New Issue
Block a user