summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRagnar Thomsen <[email protected]>2015-05-25 21:17:14 +0200
committerRagnar Thomsen <[email protected]>2015-05-25 21:17:14 +0200
commite064279af8b4b3b78ad575700764ad0ae7e81ac1 (patch)
tree4b98a38f097558d58ec6730995664b7d3bb2ae43
parent1fa411cd6b2ee48730d11fb830c0e9de049631e3 (diff)
Time jobs using a QElapsedTimer. This is useful for comparing performance of plugins.
-rw-r--r--kerfuffle/jobs.cpp7
-rw-r--r--kerfuffle/jobs.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/kerfuffle/jobs.cpp b/kerfuffle/jobs.cpp
index e184afd..061b75e 100644
--- a/kerfuffle/jobs.cpp
+++ b/kerfuffle/jobs.cpp
@@ -79,6 +79,8 @@ Job::Job(ReadOnlyArchiveInterface *interface, QObject *parent)
}
setCapabilities(KJob::Killable);
+
+ jobTimer = new QElapsedTimer;
}
Job::~Job()
@@ -102,6 +104,7 @@ bool Job::isRunning() const
void Job::start()
{
+ jobTimer->start();
m_isRunning = true;
d->start();
}
@@ -153,7 +156,7 @@ void Job::onEntryRemoved(const QString & path)
void Job::onFinished(bool result)
{
- qCDebug(KERFUFFLE) << "Job finished, result:" << result;
+ qCDebug(KERFUFFLE) << "Job finished, result:" << result << ", time:" << jobTimer->elapsed() << "ms";
archiveInterface()->disconnect(this);
@@ -186,6 +189,8 @@ ListJob::ListJob(ReadOnlyArchiveInterface *interface, QObject *parent)
void ListJob::doWork()
{
+
+
emit description(this, i18n("Loading archive..."));
connectToArchiveInterfaceSignals();
bool ret = archiveInterface()->list();
diff --git a/kerfuffle/jobs.h b/kerfuffle/jobs.h
index f183c15..5e177d3 100644
--- a/kerfuffle/jobs.h
+++ b/kerfuffle/jobs.h
@@ -37,6 +37,7 @@
#include <QList>
#include <QVariant>
#include <QString>
+#include <QElapsedTimer>
namespace Kerfuffle
{
@@ -84,6 +85,7 @@ private:
ReadOnlyArchiveInterface *m_archiveInterface;
bool m_isRunning;
+ QElapsedTimer *jobTimer;
class Private;
Private * const d;