[Pkg-owncloud-commits] [owncloud-client] 238/333: Use a stopwatch to meassure the time consumed.

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Apr 17 23:16:58 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit dd6b71bad683b6e3724351b888435f542c1f04cf
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Wed Mar 26 18:06:25 2014 +0100

    Use a stopwatch to meassure the time consumed.
---
 src/mirall/syncengine.cpp | 17 ++++++++++++-----
 src/mirall/syncengine.h   | 10 +++++-----
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/mirall/syncengine.cpp b/src/mirall/syncengine.cpp
index f7f618f..ebc647e 100644
--- a/src/mirall/syncengine.cpp
+++ b/src/mirall/syncengine.cpp
@@ -368,6 +368,12 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
     }
     _needsUpdate = true;
 
+    item.other._etag        = file->other.etag;
+    item.other._fileId      = file->other.file_id;
+    item.other._instruction = file->other.instruction;
+    item.other._modtime     = file->other.modtime;
+    item.other._size        = file->other.size;
+
     _syncedItems.append(item);
     emit syncItemDisconvered(item);
     return re;
@@ -479,8 +485,7 @@ void SyncEngine::startSync()
     csync_set_log_callback( csyncLogCatcher );
     //csync_set_log_level( 11 ); don't set the loglevel here, it shall be done by folder.cpp or owncloudcmd.cpp
 
-    _syncTime.start();
-
+    _stopWatch.start();
 
     qDebug() << "#### Update start #################################################### >>";
 
@@ -496,13 +501,13 @@ void SyncEngine::slotUpdateFinished(int updateResult)
         handleSyncError(_csync_ctx, "csync_update");
         return;
     }
-    qDebug() << "<<#### Update end #################################################### " << _syncTime.elapsed();
+    qDebug() << "<<#### Update end #################################################### " << _stopWatch.addLapTime(QLatin1String("Update Finished"));
 
     if( csync_reconcile(_csync_ctx) < 0 ) {
         handleSyncError(_csync_ctx, "csync_reconcile");
         return;
     }
-
+    _stopWatch.addLapTime(QLatin1String("Reconcile Finished"));
 
     _progressInfo = Progress::Info();
 
@@ -629,7 +634,9 @@ void SyncEngine::slotFinished()
 
     csync_commit(_csync_ctx);
 
-    qDebug() << "CSync run took " << _syncTime.elapsed() << " Milliseconds";
+    qDebug() << "CSync run took " << _stopWatch.addLapTime(QLatin1String("Sync Finished"));
+    _stopWatch.stop();
+
     emit finished();
     _propagator.reset(0);
     _syncMutex.unlock();
diff --git a/src/mirall/syncengine.h b/src/mirall/syncengine.h
index 6327ab8..58f2894 100644
--- a/src/mirall/syncengine.h
+++ b/src/mirall/syncengine.h
@@ -27,6 +27,7 @@
 
 #include "mirall/syncfileitem.h"
 #include "mirall/progressdispatcher.h"
+#include "mirall/utility.h"
 
 class QProcess;
 
@@ -59,6 +60,8 @@ public:
     /* Abort the sync.  Called from the main thread */
     void abort();
 
+    Utility::StopWatch stopWatch() { return _stopWatch; }
+
 signals:
     void csyncError( const QString& );
     void csyncWarning( const QString& );
@@ -91,8 +94,6 @@ private slots:
     void slotUpdateFinished(int updateResult);
 
 private:
-
-
     void handleSyncError(CSYNC *ctx, const char *state);
 
     static int treewalkLocal( TREE_WALK_FILE*, void *);
@@ -110,13 +111,14 @@ private:
     QString _remotePath;
     SyncJournalDb *_journal;
     QScopedPointer <OwncloudPropagator> _propagator;
-    QElapsedTimer _syncTime;
     QString _lastDeleted; // if the last item was a path and it has been deleted
     QHash <QString, QString> _seenFiles;
     QThread _thread;
 
     Progress::Info _progressInfo;
 
+    Utility::StopWatch _stopWatch;
+
     // maps the origin and the target of the folders that have been renamed
     QHash<QString, QString> _renamedFolders;
     QString adjustRenamedPath(const QString &original);
@@ -125,8 +127,6 @@ private:
 
     int _downloadLimit;
     int _uploadLimit;
-
-    friend struct CSyncRunScopeHelper;
 };
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list