1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-01 03:40:16 +02:00

* Cleanup debug output a bit.

This commit is contained in:
Christian Muehlhaeuser
2011-09-12 07:28:40 +02:00
parent 2c9c5ea8bb
commit f48c2c9b5c
5 changed files with 24 additions and 8 deletions

View File

@@ -26,6 +26,9 @@
#include "database/databasecommandloggable.h" #include "database/databasecommandloggable.h"
#include "utils/logger.h" #include "utils/logger.h"
#ifndef QT_NO_DEBUG
//#define DEBUG_TIMING TRUE
#endif
DatabaseWorker::DatabaseWorker( DatabaseImpl* lib, Database* db, bool mutates ) DatabaseWorker::DatabaseWorker( DatabaseImpl* lib, Database* db, bool mutates )
: QThread() : QThread()
@@ -46,7 +49,12 @@ DatabaseWorker::~DatabaseWorker()
tDebug() << Q_FUNC_INFO << m_outstanding; tDebug() << Q_FUNC_INFO << m_outstanding;
if ( m_outstanding ) if ( m_outstanding )
tDebug() << "Outstanding db commands to finish:" << m_commands; {
foreach ( const QSharedPointer<DatabaseCommand>& cmd, m_commands )
{
tDebug() << "Outstanding db command to finish:" << cmd->guid() << cmd->commandname();
}
}
thread()->quit(); thread()->quit();
wait(); wait();
@@ -91,8 +99,10 @@ DatabaseWorker::doWork()
*/ */
#ifdef DEBUG_TIMING
QTime timer; QTime timer;
timer.start(); timer.start();
#endif
QSharedPointer<DatabaseCommand> cmd; QSharedPointer<DatabaseCommand> cmd;
{ {
@@ -160,10 +170,16 @@ DatabaseWorker::doWork()
} }
} }
//uint duration = timer.elapsed(); #ifdef DEBUG_TIMING
//qDebug() << "DBCmd Duration:" << duration << "ms, now running postcommit for" << cmd->commandname(); uint duration = timer.elapsed();
tDebug() << "DBCmd Duration:" << duration << "ms, now running postcommit for" << cmd->commandname();
#endif
cmd->postCommit(); cmd->postCommit();
//qDebug() << "Post commit finished for"<< cmd->commandname();
#ifdef DEBUG_TIMING
tDebug() << "Post commit finished in" << timer.elapsed() - duration << "ms for" << cmd->commandname();
#endif
} }
} }
catch( const char * msg ) catch( const char * msg )

View File

@@ -59,7 +59,7 @@ public:
int e = t.elapsed(); int e = t.elapsed();
if ( e >= TOMAHAWK_QUERY_THRESHOLD ) if ( e >= TOMAHAWK_QUERY_THRESHOLD )
tLog() << "TomahawkSqlQuery (" << lastQuery() << ") finished in" << t.elapsed() << "ms"; tLog( LOGVERBOSE ) << "TomahawkSqlQuery (" << lastQuery() << ") finished in" << t.elapsed() << "ms";
return ret; return ret;
} }

View File

@@ -337,7 +337,7 @@ Pipeline::shunt( const query_ptr& q )
if ( r ) if ( r )
{ {
tDebug() << "Dispatching to resolver" << r->name() << q->toString() << q->solved() << q->id(); tLog( LOGEXTRA ) << "Dispatching to resolver" << r->name() << q->toString() << q->solved() << q->id();
q->setCurrentResolver( r ); q->setCurrentResolver( r );
r->resolve( q ); r->resolve( q );

View File

@@ -200,7 +200,7 @@ Query::removeResult( const Tomahawk::result_ptr& result )
void void
Query::onResolvingFinished() Query::onResolvingFinished()
{ {
tDebug() << "Finished resolving:" << toString(); tDebug( LOGVERBOSE ) << "Finished resolving:" << toString();
if ( !m_resolveFinished ) if ( !m_resolveFinished )
{ {
m_resolveFinished = true; m_resolveFinished = true;

View File

@@ -72,7 +72,7 @@ log( const char *msg, unsigned int debugLevel, bool toDisk = true )
logfile.flush(); logfile.flush();
} }
if ( debugLevel <= LOGVERBOSE || (int)debugLevel <= s_threshold ) if ( debugLevel <= LOGEXTRA || (int)debugLevel <= s_threshold )
{ {
cout << msg << endl; cout << msg << endl;
cout.flush(); cout.flush();