mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
Add timing measurement
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
@@ -21,18 +22,30 @@ public:
|
|||||||
database->loadIndex();
|
database->loadIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::query_ptr query;
|
|
||||||
Tomahawk::dbcmd_ptr cmd;
|
Tomahawk::dbcmd_ptr cmd;
|
||||||
QSharedPointer<Tomahawk::Database> database;
|
QSharedPointer<Tomahawk::Database> database;
|
||||||
|
Tomahawk::query_ptr query;
|
||||||
|
|
||||||
|
// Time measurements
|
||||||
|
std::chrono::high_resolution_clock::time_point startTime;
|
||||||
|
std::chrono::high_resolution_clock::time_point resolveDoneTime;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void runCmd()
|
void runCmd()
|
||||||
{
|
{
|
||||||
database->enqueue( cmd );
|
database->enqueue( cmd );
|
||||||
|
startTime = std::chrono::high_resolution_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onResults( const Tomahawk::QID, const QList< Tomahawk::result_ptr>& results )
|
void onResults( const Tomahawk::QID, const QList< Tomahawk::result_ptr>& results )
|
||||||
{
|
{
|
||||||
|
resolveDoneTime = std::chrono::high_resolution_clock::now();
|
||||||
|
std::chrono::duration<double> duration =
|
||||||
|
std::chrono::duration_cast<std::chrono::duration<double>>( resolveDoneTime - startTime );
|
||||||
|
|
||||||
|
std::cerr << "Fulltext query took " << duration.count()
|
||||||
|
<< "s" << std::endl;
|
||||||
|
|
||||||
// Query is destructed by deleteLater() so we need to wait for the
|
// Query is destructed by deleteLater() so we need to wait for the
|
||||||
// event queue to process it.
|
// event queue to process it.
|
||||||
connect( query.data(), SIGNAL( destroyed( QObject* ) ),
|
connect( query.data(), SIGNAL( destroyed( QObject* ) ),
|
||||||
|
Reference in New Issue
Block a user