]> gitweb.hamatoma.de Git - reqt/commitdiff
rebackgui: Calculation of runtime
authorHamatoma <git.tortouse@hm.f-r-e-i.de>
Sat, 13 Feb 2016 11:10:06 +0000 (12:10 +0100)
committerHamatoma <git.tortouse@hm.f-r-e-i.de>
Sat, 13 Feb 2016 11:10:06 +0000 (12:10 +0100)
appl/rebackgui/BackupEngine.cpp
appl/rebackgui/mainwindow.cpp
base/ReQStringUtils.cpp

index 8ee51a9b082863581b7336baa3a0fe55f0105896..0a6b39a5a766c0867aa2135506b52868464c01b1 100644 (file)
@@ -206,8 +206,8 @@ void BackupTask::run()
                        node = info.mid(pos + 1);
                        copyFile(index, relPath, node);
                        if (m_verboseLevel > VerboseQuiet){
-                               qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.currentMSecsSinceEpoch();
-                               double factor = double(m_hotBytes) / max(1LL, m_processedBytes);
+                qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch();
+                double factor = double(m_processedBytes) / max(1LL, m_hotBytes);
                                m_mainWindow->externalAppend(ReGuiQueueItem::StatusLine, NULL,
                                                                                         tr("%1 of %2 (%3 of %4) %5 MB/sec runtime: %6")
                                                                                         .arg(m_processedFiles).arg(m_hotFiles)
@@ -220,7 +220,7 @@ void BackupTask::run()
        }
        m_mainWindow->externalTaskFinished(tr("backup complete after %1. Errors: %2")
                                .arg(ReQStringUtils::readableDuration(
-                                       QDateTime::currentMSecsSinceEpoch() - start.currentMSecsSinceEpoch()))
+                    QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch()))
                                                                           .arg(m_mainWindow->errors()));
 }
 
@@ -397,18 +397,18 @@ void ChecksumOfTargetTask::run()
                                        error(QObject::tr("checksum differs: ") + relPath + node
                                                  + " [" + sourceChecksum + "/" + checksum + "]");
                        }
-                       qint64 processedBytes, hotBytes;
-                       int hotFiles, processedFiles;
-                       m_mutex.lock();
-                       hotFiles = m_hotFiles;
-                       hotBytes = m_hotBytes;
-                       processedBytes = m_processedBytes;
-                       processedFiles = m_processedFiles;
-                       m_mutex.unlock();
                        if (m_verboseLevel > VerboseQuiet){
-                               now = QDateTime::currentMSecsSinceEpoch();
-                               qint64 duration = (now - start.currentMSecsSinceEpoch());
-                               double factor = double(m_hotBytes) * 2 / max(1LL, m_processedBytes);
+                qint64 processedBytes, hotBytes;
+                int hotFiles, processedFiles;
+                m_mutex.lock();
+                hotFiles = m_hotFiles;
+                hotBytes = m_hotBytes;
+                processedBytes = m_processedBytes;
+                processedFiles = m_processedFiles;
+                m_mutex.unlock();
+                now = QDateTime::currentMSecsSinceEpoch();
+                qint64 duration = (now - start.toMSecsSinceEpoch());
+                double factor = m_processedBytes / double(max(1LL, m_hotBytes * 2));
                                m_mainWindow->externalAppend(ReGuiQueueItem::StatusLine, NULL,
                                                                                         tr("%1 of %2 (%3 of %4) %5 MB/sec runtime: %6")
                                        .arg(processedFiles).arg(hotFiles * 2)
@@ -422,7 +422,7 @@ void ChecksumOfTargetTask::run()
        }
        now = QDateTime::currentMSecsSinceEpoch();
        m_mainWindow->externalTaskFinished(tr("Building target checksums complete after %1. Processed: %2 Errors: %3")
-                               .arg(ReQStringUtils::readableDuration(now - start.currentMSecsSinceEpoch()))
+                .arg(ReQStringUtils::readableDuration(now - start.toMSecsSinceEpoch()))
                                                                           .arg(count)
                                                                           .arg(m_mainWindow->errors()));
 }
@@ -526,8 +526,8 @@ void CleanTask::run()
                                break;
                        }
                        if (m_verboseLevel > VerboseQuiet){
-                               double factor = double(m_hotFiles) / max(1, m_processedFiles);
-                               qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.currentMSecsSinceEpoch();
+                double factor = double(m_processedFiles) / max(1, m_hotFiles);
+                qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch();
                                m_mainWindow->externalAppend(ReGuiQueueItem::StatusLine, NULL,
                                                                                         tr("%1 of %2 (%3 of %4) %5 MB/sec runtime: %6")
                                                                                         .arg(m_processedFiles)
@@ -542,7 +542,7 @@ void CleanTask::run()
        }
        m_mainWindow->externalTaskFinished(tr("backup complete after %1. Errors: %2")
                                .arg(ReQStringUtils::readableDuration(
-                                       QDateTime::currentMSecsSinceEpoch() - start.currentMSecsSinceEpoch()))
+                    QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch()))
                                                                           .arg(m_mainWindow->errors()));
 }
 
@@ -639,29 +639,29 @@ void SearchTask::searchOneDirectory(const QString& source,
                   m_mutex.unlock();
           } else {
                   qint64 diff = 0;
-                  bool doCopy = false;
+           bool doTransfer = false;
                   if (! m_compareWithTarget)
-                          doCopy = true;
+               doTransfer = true;
                   else if (target.isEmpty())
-                          doCopy = true;
+               doTransfer = true;
                   else {
                           QFileInfo trg(target + it.fileName());
                           if (! trg.exists())
-                                  doCopy = true;
+                   doTransfer = true;
                           else {
                                   const QFileInfo src = it.fileInfo();
                                   if (trg.size() != src.size())
-                                          doCopy = true;
+                       doTransfer = true;
                                   else if ((diff = src.lastModified().toMSecsSinceEpoch()
                                                   - trg.lastModified().toMSecsSinceEpoch()) > 2000)
-                                          doCopy = true;
+                       doTransfer = true;
                           }
                   }
-                  if (doCopy){
+           if (doTransfer){
                           info = prefix + it.fileName();
                   }
                   m_mutex.lock();
-                  if (doCopy){
+           if (doTransfer){
                           m_files.append(info);
                           m_hotFiles++;
                           m_hotBytes += it.fileInfo().size();
index c6bb0368ffb4001df31dadab34c2c0397608d7e7..860aa0631a0207d5e784e2a3614ab9d5f2097a40 100644 (file)
@@ -13,7 +13,7 @@
 #include "aboutdialog.hpp"
 #include <QFileDialog>
 
-const QString VERSION("2016.01.31");
+const QString VERSION("2016.02.13");
 
 /**
  * Constructor.
index 48057d59ea821e429a25c069567abf39d981f5f8..827190571e2760c463910b6d4e6bf1db1ef1c440 100644 (file)
@@ -546,7 +546,7 @@ QString ReQStringUtils::readableDuration(qint64 durationMilliSec){
  */
 QString ReQStringUtils::runtimeEstimation(const QDateTime& start,
                double factor){
-       qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.currentMSecsSinceEpoch();
+    qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch();
        if (factor < 1)
                factor = 1;
        else if (factor <= 0.001)