Remove SyncFileItem::_requestDuration #5456
authorJocelyn Turcotte <jturcotte@woboq.com>
Thu, 26 Jan 2017 12:39:00 +0000 (13:39 +0100)
committerJocelyn Turcotte <jturcotte@woboq.com>
Thu, 26 Jan 2017 16:13:54 +0000 (17:13 +0100)
This will save a QElapsedTimer in each job that was used only for
.owncloudsync.log (for which the request duration doesn't bring much
value).

12 files changed:
src/gui/syncrunfilelog.cpp
src/libsync/abstractnetworkjob.cpp
src/libsync/abstractnetworkjob.h
src/libsync/propagatedownload.cpp
src/libsync/propagateremotedelete.cpp
src/libsync/propagateremotemkdir.cpp
src/libsync/propagateremotemove.cpp
src/libsync/propagateupload.cpp
src/libsync/propagateupload.h
src/libsync/propagateuploadng.cpp
src/libsync/propagateuploadv1.cpp
src/libsync/syncfileitem.h

index 7e2877e3dfbb1b5f5344614eaaa20d85504e528c..c0f5c142fb4cf5ce23b513d2d6662d5a751f5011 100644 (file)
@@ -145,7 +145,7 @@ void SyncRunFileLog::logItem( const SyncFileItem& item )
 
     const QChar L = QLatin1Char('|');
     _out << ts << L;
-    _out << QString::number(item._requestDuration) << L;
+    _out << L;
     if( item._instruction != CSYNC_INSTRUCTION_RENAME ) {
         _out << item._file << L;
     } else {
index aa3b49fde1ba2383afef3834c74db9d0aed5f7fd..ab09786fc6325272fe099f2f7ee83c19cbee4b6f 100644 (file)
@@ -172,7 +172,6 @@ void AbstractNetworkJob::slotFinished()
 
     // get the Date timestamp from reply
     _responseTimestamp = _reply->rawHeader("Date");
-    _duration = _durationTimer.elapsed();
 
     if (_followRedirects) {
         // ### the qWarnings here should be exported via displayErrors() so they
@@ -206,11 +205,6 @@ void AbstractNetworkJob::slotFinished()
     }
 }
 
-quint64 AbstractNetworkJob::duration()
-{
-    return _duration;
-}
-
 QByteArray AbstractNetworkJob::responseTimestamp()
 {
     return _responseTimestamp;
@@ -224,8 +218,6 @@ AbstractNetworkJob::~AbstractNetworkJob()
 void AbstractNetworkJob::start()
 {
     _timer.start();
-    _durationTimer.start();
-    _duration = 0;
 
     const QUrl url = account()->url();
     const QString displayUrl = QString( "%1://%2%3").arg(url.scheme()).arg(url.host()).arg(url.path());
index 5a4728cc32731167c5fa942662d8f790f81ac0a9..6f7d3cbe56ab56c9f41e6ef08c6b7093217ddd94 100644 (file)
@@ -55,7 +55,6 @@ public:
     bool ignoreCredentialFailure() const { return _ignoreCredentialFailure; }
 
     QByteArray responseTimestamp();
-    quint64 duration();
 
     qint64 timeoutMsec() { return _timer.interval(); }
 
@@ -82,8 +81,6 @@ protected:
     int maxRedirects() const { return 10; }
     virtual bool finished() = 0;
     QByteArray    _responseTimestamp;
-    QElapsedTimer _durationTimer;
-    quint64       _duration;
     bool          _timedout;  // set to true when the timeout slot is received
 
     // Automatically follows redirects. Note that this only works for
index 28f96feadd33c9b708b96c713e7431f0ffc8db97..f3d0ec0025b6e478a8108815b323108e911b9a34 100644 (file)
@@ -520,7 +520,6 @@ void PropagateDownloadFile::slotGetFinished()
         // so make sure we have the up-to-date time
         _item->_modtime = job->lastModified();
     }
-    _item->_requestDuration = job->duration();
     _item->_responseTimeStamp = job->responseTimestamp();
 
     _tmpFile.close();
index 67d50c63dd42a5a9f7ef2774e676c998d59e61b9..5074269b3d2f469b31bf7195496e844b7c9e6df8 100644 (file)
@@ -104,7 +104,6 @@ void PropagateRemoteDelete::slotDeleteJobFinished()
         return;
     }
 
-    _item->_requestDuration = _job->duration();
     _item->_responseTimeStamp = _job->responseTimestamp();
 
     // A 404 reply is also considered a success here: We want to make sure
index 8a0b7db80c76a09cbf4769ab5e3a798607233430..01fd38a5213bdf767c5328777ab69da131bdc391 100644 (file)
@@ -99,7 +99,6 @@ void PropagateRemoteMkdir::slotMkcolJobFinished()
         return;
     }
 
-    _item->_requestDuration = _job->duration();
     _item->_responseTimeStamp = _job->responseTimestamp();
     _item->_fileId = _job->reply()->rawHeader("OC-FileId");
 
index 606488081dda41ea3ebcf1adf8c1b4ebf10d6b26..f3f9391508acd494e094ccbf693aa6c9e3ae16be 100644 (file)
@@ -145,7 +145,6 @@ void PropagateRemoteMove::slotMoveJobFinished()
         return;
     }
 
-    _item->_requestDuration = _job->duration();
     _item->_responseTimeStamp = _job->responseTimestamp();
 
     if (_item->_httpErrorCode != 201 ) {
index b07041ab60c0ee880fe64bc5b6366d2865198e3a..cd0b4a2328b18f3b808e84e87d04a0cebf95c3f8 100644 (file)
@@ -569,7 +569,6 @@ QMap<QByteArray, QByteArray> PropagateUploadFileCommon::headers()
 
 void PropagateUploadFileCommon::finalize()
 {
-    _item->_requestDuration = _duration.elapsed();
     _finished = true;
 
     if (!propagator()->_journal->setFileRecord(SyncJournalFileRecord(*_item, propagator()->getFilePath(_item->_file)))) {
index 3179585cffb8b69dc1a0a4a638f187d8e335f792..3638acdbbfc1f0de92f8b62bc7d171ec2c71ee45 100644 (file)
@@ -183,7 +183,6 @@ class PropagateUploadFileCommon : public PropagateItemJob {
     Q_OBJECT
 
 protected:
-    QElapsedTimer _duration;
     QVector<AbstractNetworkJob*> _jobs; /// network jobs that are currently in transit
     bool _finished; /// Tells that all the jobs have been finished
     bool _deleteExisting;
index 04747c91f292ac5856074a334881a4f4d87c7b2e..459d9991b3e6df8aacb813f3573db0e99c51f938 100644 (file)
@@ -80,7 +80,6 @@ QUrl PropagateUploadFileNG::chunkUrl(int chunk)
 
 void PropagateUploadFileNG::doStartUpload()
 {
-    _duration.start();
     propagator()->_activeJobList.append(this);
 
     const SyncJournalDb::UploadInfo progressInfo = propagator()->_journal->getUploadInfo(_item->_file);
@@ -485,11 +484,11 @@ void PropagateUploadFileNG::slotMoveJobFinished()
     _item->_responseTimeStamp = job->responseTimestamp();
 
     // performance logging
-    _item->_requestDuration = _stopWatch.stop();
+    quint64 duration = _stopWatch.stop();
     qDebug() << "*==* duration UPLOAD" << _item->_size
              << _stopWatch.durationOfLap(QLatin1String("ContentChecksum"))
              << _stopWatch.durationOfLap(QLatin1String("TransmissionChecksum"))
-             << _item->_requestDuration;
+             << duration;
     // The job might stay alive for the whole sync, release this tiny bit of memory.
     _stopWatch.reset();
     finalize();
index 1bffd7ff7e5c648ffca784905fa6aa9afb637c47..21778a7d3de2c608338210531ac72c23282e763c 100644 (file)
@@ -49,7 +49,6 @@ void PropagateUploadFileV1::doStartUpload()
     }
 
     _currentChunk = 0;
-    _duration.start();
 
     emit progress(*_item, 0);
     startNextChunk();
@@ -341,11 +340,11 @@ void PropagateUploadFileV1::slotPutFinished()
     }
 
     // performance logging
-    _item->_requestDuration = _stopWatch.stop();
+    quint64 duration = _stopWatch.stop();
     qDebug() << "*==* duration UPLOAD" << _item->_size
              << _stopWatch.durationOfLap(QLatin1String("ContentChecksum"))
              << _stopWatch.durationOfLap(QLatin1String("TransmissionChecksum"))
-             << _item->_requestDuration;
+             << duration;
     // The job might stay alive for the whole sync, release this tiny bit of memory.
     _stopWatch.reset();
 
index 221dbfd2f88eebada4e74e8178b0e5551cf59fda..157d03c05f7a5212f8886521a227c58edfa66589 100644 (file)
@@ -68,7 +68,7 @@ public:
          _serverHasIgnoredFiles(false), _hasBlacklistEntry(false),
          _errorMayBeBlacklisted(false), _status(NoStatus),
         _isRestoration(false),
-        _httpErrorCode(0), _requestDuration(0), _affectedItems(1),
+        _httpErrorCode(0), _affectedItems(1),
         _instruction(CSYNC_INSTRUCTION_NONE), _modtime(0), _size(0), _inode(0)
     {
     }
@@ -160,7 +160,6 @@ public:
     quint16              _httpErrorCode;
     QString              _errorString; // Contains a string only in case of error
     QByteArray           _responseTimeStamp;
-    quint64              _requestDuration;
     quint32              _affectedItems; // the number of affected items by the operation on this item.
      // usually this value is 1, but for removes on dirs, it might be much higher.