From 0a5cb17f2586304fba998b9df2519ebddaad30a5 Mon Sep 17 00:00:00 2001
From: Pawel Polanski <pawel.3.polanski@nokia.com>
Date: Tue, 7 Dec 2010 15:20:09 +0100
Subject: [PATCH] Information about the time that took the CODA to process a
 command.

---
 tests/tools/codaclient/codaclientapplication.cpp | 5 ++++-
 tests/tools/codaclient/codaclientapplication.h   | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/tools/codaclient/codaclientapplication.cpp b/tests/tools/codaclient/codaclientapplication.cpp
index ee41dc5bdf5..7b81df976a0 100644
--- a/tests/tools/codaclient/codaclientapplication.cpp
+++ b/tests/tools/codaclient/codaclientapplication.cpp
@@ -251,6 +251,7 @@ CodaClientApplication::ParseArgsResult CodaClientApplication::parseArguments(QSt
 
 bool CodaClientApplication::start()
 {
+    m_startTime.start();
     switch (m_mode) {
     case Launch: {
         const QString args = m_launchArgs.join(QString(QLatin1Char(' ')));
@@ -405,7 +406,7 @@ void CodaClientApplication::handleFileSystemFStat(const tcftrk::TcfTrkCommandRes
 void CodaClientApplication::handleFileSystemClose(const tcftrk::TcfTrkCommandResult &result)
 {
     if (result.type == tcftrk::TcfTrkCommandResult::SuccessReply) {
-        std::printf("File closed.\n.");
+        std::printf("File closed.\n");
         const bool ok = m_mode == Put ? m_putWriteOk : m_statFstatOk;
         doExit(ok ? 0 : -1);
     } else {
@@ -485,6 +486,8 @@ void CodaClientApplication::slotTcftrkEvent (const tcftrk::TcfTrkEvent &ev)
 
 void CodaClientApplication::doExit(int ex)
 {
+    std::printf("Operation took %4.2f second(s)\n", m_startTime.elapsed()/1000.);
+
     if (!m_trkDevice.isNull()) {
         const QSharedPointer<QIODevice> dev = m_trkDevice->device();
         if (QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(dev.data())) {
diff --git a/tests/tools/codaclient/codaclientapplication.h b/tests/tools/codaclient/codaclientapplication.h
index b195925048e..e5aa33d7045 100644
--- a/tests/tools/codaclient/codaclientapplication.h
+++ b/tests/tools/codaclient/codaclientapplication.h
@@ -33,6 +33,7 @@
 #include <QtCore/QCoreApplication>
 #include <QtCore/QStringList>
 #include <QtCore/QSharedPointer>
+#include <QtCore/QTime>
 
 QT_FORWARD_DECLARE_CLASS(QFile)
 
@@ -95,6 +96,7 @@ private:
     QByteArray m_remoteFileHandle;
     quint64 m_putChunkSize;
     unsigned m_verbose;
+    QTime m_startTime;
     QScopedPointer<tcftrk::TcfTrkDevice> m_trkDevice;
 };
 
-- 
GitLab