Index: src/ch/ch.rc =================================================================== diff -u -re8897f4f07ba4523376c2d6599d87428424a4772 -r9fcf462ad4a28203a3d34ded6da7125d4dcc925c --- src/ch/ch.rc (.../ch.rc) (revision e8897f4f07ba4523376c2d6599d87428424a4772) +++ src/ch/ch.rc (.../ch.rc) (revision 9fcf462ad4a28203a3d34ded6da7125d4dcc925c) @@ -140,8 +140,8 @@ LTEXT "List of tasks:",IDC_TASKLIST_LABEL_STATIC,7,10,145,8 CONTROL "",IDC_GLOBAL_PROGRESS,"msctls_progress32",0x0,71,250,153,7 LTEXT "Progress:",IDC_GLOBALPROGRESS_LABEL_STATIC,13,249,54,8 - CONTROL "",IDC_TASKSIZE_PROGRESS,"msctls_progress32",0x0,332,127,165,6 - LTEXT "Size of items:",IDC_TASKSIZE_LABEL_STATIC,244,126,86,8 + CONTROL "",IDC_TASKSIZE_PROGRESS,"msctls_progress32",0x0,332,129,165,6 + LTEXT "Size of items:",IDC_TASKSIZE_LABEL_STATIC,244,128,86,8 LTEXT "Destination:",IDC_DESTINATIONOBJECT_LABEL_STATIC,244,59,86,8 LTEXT "Source:",IDC_SOURCEOBJECT_LABEL_STATIC,244,46,86,8 LTEXT "Buffer size:",IDC_BUFFERSIZE_LABEL_STATIC,244,73,86,8 @@ -151,7 +151,7 @@ LTEXT "Processed:",IDC_GLOBALPROCESSED_LABEL_STATIC,13,222,54,8 LTEXT "Estimated time:",IDC_TASKTIME_LABEL_STATIC,244,103,86,8 PUSHBUTTON "&Resume",IDC_RESUME_BUTTON,52,190,44,14 - LTEXT "Task ID:",IDC_TASKID_LABEL_STATIC,244,19,86,8 + LTEXT "Task name:",IDC_TASKID_LABEL_STATIC,244,19,86,8 CONTROL "",IDC_TASKID_STATIC,"STATICEX",0x4,332,18,118,12,WS_EX_STATICEDGE CONTROL "",IDC_OPERATION_STATIC,"STATICEX",0x4,332,32,165,12,WS_EX_STATICEDGE CONTROL "",IDC_SOURCEOBJECT_STATIC,"STATICEX",0x4,332,45,165,12,WS_EX_STATICEDGE @@ -161,22 +161,22 @@ CONTROL "",IDC_GLOBALTRANSFER_STATIC,"STATICEX",0x4,71,234,153,12,WS_EX_STATICEDGE CONTROL "",IDC_BUFFERSIZE_STATIC,"STATICEX",0x4,332,72,151,12,WS_EX_STATICEDGE CONTROL "",IDC_THREADPRIORITY_STATIC,"STATICEX",0x4,332,86,151,12,WS_EX_STATICEDGE - CONTROL "",IDC_SUBTASKCOUNT_PROGRESS,"msctls_progress32",0x0,332,238,165,6 - LTEXT "Count of items:",IDC_SUBTASKCOUNT_LABEL_STATIC,244,237,86,8 - CONTROL "",IDC_SUBTASKSIZE_PROGRESS,"msctls_progress32",0x0,332,248,165,6 - LTEXT "Size of items:",IDC_SUBTASKSIZE_LABEL_STATIC,244,247,86,8 + CONTROL "",IDC_SUBTASKCOUNT_PROGRESS,"msctls_progress32",0x0,332,240,165,6 + LTEXT "Count of items:",IDC_SUBTASKCOUNT_LABEL_STATIC,244,239,86,8 + CONTROL "",IDC_SUBTASKSIZE_PROGRESS,"msctls_progress32",0x0,332,251,165,6 + LTEXT "Size of items:",IDC_SUBTASKSIZE_LABEL_STATIC,244,250,86,8 LTEXT "Processed items:",IDC_SUBTASKPROCESSED_LABEL_STATIC,244,186,86,8 CONTROL "",IDC_SUBTASKPROCESSED_STATIC,"STATICEX",0x4,332,185,165,12,WS_EX_STATICEDGE LTEXT "Estimated time:",IDC_SUBTASKTIME_LABEL_STATIC,244,214,86,8 CONTROL "",IDC_SUBTASKTIME_STATIC,"STATICEX",0x4,332,213,165,12,WS_EX_STATICEDGE - CONTROL "",IDC_TASKCOUNT_PROGRESS,"msctls_progress32",0x0,332,117,165,6 - LTEXT "Count of items:",IDC_TASKCOUNT_LABEL_STATIC,244,116,86,8 + CONTROL "",IDC_TASKCOUNT_PROGRESS,"msctls_progress32",0x0,332,118,165,6 + LTEXT "Count of items:",IDC_TASKCOUNT_LABEL_STATIC,244,117,86,8 LTEXT "Processing speed:",IDC_SUBTASKTRANSFER_LABEL_STATIC,244,200,86,8 CONTROL "",IDC_SUBTASKTRANSFER_STATIC,"STATICEX",0x4,332,199,165,12,WS_EX_STATICEDGE LTEXT "Current phase:",IDC_SUBTASKNAME_LABEL_STATIC,244,158,86,8 CONTROL "",IDC_SUBTASKNAME_STATIC,"STATICEX",0x4,332,157,165,12,WS_EX_STATICEDGE - CONTROL "",IDC_CURRENTOBJECT_PROGRESS,"msctls_progress32",0x0,332,228,165,6 - LTEXT "Current item:",IDC_CURRENTOBJECT_LABEL_STATIC,244,227,86,8 + CONTROL "",IDC_CURRENTOBJECT_PROGRESS,"msctls_progress32",0x0,332,229,165,6 + LTEXT "Current item:",IDC_CURRENTOBJECT_LABEL_STATIC,244,228,86,8 GROUPBOX "Task information",IDC_TASKINFORMATION_GROUP_STATIC,237,7,268,134,0,WS_EX_TRANSPARENT GROUPBOX "Details",IDC_CURRENTPHASE_GROUP_STATIC,237,145,268,118,0,WS_EX_TRANSPARENT GROUPBOX "Global statistics",IDC_GLOBAL_GROUP_STATIC,7,210,223,53,0,WS_EX_TRANSPARENT Index: src/libchengine/TSubTaskScanDirectory.cpp =================================================================== diff -u -re8897f4f07ba4523376c2d6599d87428424a4772 -r9fcf462ad4a28203a3d34ded6da7125d4dcc925c --- src/libchengine/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision e8897f4f07ba4523376c2d6599d87428424a4772) +++ src/libchengine/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision 9fcf462ad4a28203a3d34ded6da7125d4dcc925c) @@ -45,7 +45,7 @@ // class TSubTaskScanDirectories TSubTaskScanDirectories::TSubTaskScanDirectories(TSubTaskContext& rContext) : TSubTaskBase(rContext), - m_tSubTaskStats(eSubOperation_Scanning), + m_tSubTaskStats(eSubOperation_Scanning, true), m_spLog(std::make_unique(rContext.GetLogFileData(), L"ST-ScanDirs")) { } @@ -108,7 +108,7 @@ // new stats m_tSubTaskStats.SetCurrentBufferIndex(TBufferSizes::eBuffer_Default); - m_tSubTaskStats.SetTotalCount(spBasePaths->GetCount()); + m_tSubTaskStats.SetTotalCount(0); m_tSubTaskStats.SetProcessedCount(0); m_tSubTaskStats.SetTotalSize(0); m_tSubTaskStats.SetProcessedSize(0); @@ -203,7 +203,14 @@ // update stats m_tSubTaskStats.SetCurrentIndex(fcIndex); - m_tSubTaskStats.SetProcessedCount(fcIndex); + + auto totalCount = rFilesCache.GetCount(); + m_tSubTaskStats.SetTotalCount(totalCount); + m_tSubTaskStats.SetProcessedCount(totalCount); + auto totalSize = rFilesCache.CalculateTotalSize(); + m_tSubTaskStats.SetTotalSize(totalSize); + m_tSubTaskStats.SetProcessedSize(totalSize); + m_tSubTaskStats.SetCurrentPath(TString()); rFilesCache.SetComplete(true); @@ -269,6 +276,13 @@ } } + auto totalCount = rFilesCache.GetCount(); + m_tSubTaskStats.SetTotalCount(totalCount); + m_tSubTaskStats.SetProcessedCount(totalCount); + auto totalSize = rFilesCache.CalculateTotalSize(); + m_tSubTaskStats.SetTotalSize(totalSize); + m_tSubTaskStats.SetProcessedSize(totalSize); + return stFilesCount; } Index: src/libchengine/TSubTaskStatsInfo.cpp =================================================================== diff -u -r0d5b67ee96b435d63f7bf075dc8e28603793b187 -r9fcf462ad4a28203a3d34ded6da7125d4dcc925c --- src/libchengine/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision 0d5b67ee96b435d63f7bf075dc8e28603793b187) +++ src/libchengine/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision 9fcf462ad4a28203a3d34ded6da7125d4dcc925c) @@ -28,6 +28,7 @@ #include "../libchcore/ErrorCodes.h" #include #include "../libserializer/ISerializerRowData.h" +#include "../libchcore/MathFunctions.h" using namespace chcore; using namespace string; @@ -38,7 +39,7 @@ /////////////////////////////////////////////////////////////////////////////////// // class TSubTaskStatsInfo - TSubTaskStatsInfo::TSubTaskStatsInfo(ESubOperationType eSubTaskType) : + TSubTaskStatsInfo::TSubTaskStatsInfo(ESubOperationType eSubTaskType, bool bIgnoreSizeSpeed) : m_bSubTaskIsRunning(m_setModifications, false), m_ullTotalSize(m_setModifications, 0), m_ullProcessedSize(m_setModifications, 0), @@ -54,7 +55,8 @@ m_iCurrentBufferIndex(m_setModifications, 0), m_strCurrentPath(m_setModifications), m_bIsInitialized(m_setModifications, false), - m_eSubOperationType(eSubTaskType) + m_eSubOperationType(eSubTaskType), + m_bIgnoreSizeSpeed(bIgnoreSizeSpeed) { m_setModifications[eMod_Added] = true; } @@ -89,16 +91,26 @@ if (m_bSubTaskIsRunning) UpdateTime(lock); + auto totalTime = m_tTimer.Get().GetTotalTime(); + spStatsSnapshot->SetRunning(m_bSubTaskIsRunning); spStatsSnapshot->SetProcessedCount(m_fcProcessedCount); spStatsSnapshot->SetTotalCount(m_fcTotalCount); spStatsSnapshot->SetProcessedSize(m_ullProcessedSize); spStatsSnapshot->SetTotalSize(m_ullTotalSize); spStatsSnapshot->SetCurrentBufferIndex(m_iCurrentBufferIndex); spStatsSnapshot->SetCurrentPath(m_strCurrentPath); - spStatsSnapshot->SetTimeElapsed(m_tTimer.Get().GetTotalTime()); + spStatsSnapshot->SetTimeElapsed(totalTime); + spStatsSnapshot->SetSizeSpeed(m_tSizeSpeed.Get().GetSpeed()); + if(!m_bIgnoreSizeSpeed) + spStatsSnapshot->SetAvgSizeSpeed(totalTime != 0 ? Math::Div64(m_ullProcessedSize, totalTime / 1000.0) : 0.0); + else + spStatsSnapshot->SetAvgSizeSpeed(0.0); + spStatsSnapshot->SetCountSpeed(m_tCountSpeed.Get().GetSpeed()); + spStatsSnapshot->SetAvgCountSpeed(totalTime != 0 ? Math::Div64(m_fcProcessedCount, totalTime / 1000.0) : 0.0); + spStatsSnapshot->SetCurrentItemProcessedSize(m_ullCurrentItemProcessedSize); spStatsSnapshot->SetCurrentItemTotalSize(m_ullCurrentItemTotalSize); spStatsSnapshot->SetSubOperationType(m_eSubOperationType); @@ -163,7 +175,8 @@ boost::unique_lock lock(m_lock); m_ullProcessedSize.Modify() += ullIncreaseBy; - m_tSizeSpeed.Modify().AddSample(ullIncreaseBy, m_tTimer.Modify().Tick()); + if(!m_bIgnoreSizeSpeed) + m_tSizeSpeed.Modify().AddSample(ullIncreaseBy, m_tTimer.Modify().Tick()); _ASSERTE(m_ullProcessedSize <= m_ullTotalSize); if (m_ullProcessedSize > m_ullTotalSize) @@ -176,7 +189,8 @@ m_ullProcessedSize.Modify() -= ullDecreaseBy; // we didn't process anything here - hence the 0-sized sample - m_tSizeSpeed.Modify().AddSample(0, m_tTimer.Modify().Tick()); + if(!m_bIgnoreSizeSpeed) + m_tSizeSpeed.Modify().AddSample(0, m_tTimer.Modify().Tick()); _ASSERTE(m_ullProcessedSize <= m_ullTotalSize); if (m_ullProcessedSize > m_ullTotalSize) @@ -187,7 +201,8 @@ { boost::unique_lock lock(m_lock); - m_tSizeSpeed.Modify().AddSample(ullProcessedSize > m_ullProcessedSize ? ullProcessedSize - m_ullProcessedSize : 0, m_tTimer.Modify().Tick()); + if(!m_bIgnoreSizeSpeed) + m_tSizeSpeed.Modify().AddSample(ullProcessedSize > m_ullProcessedSize ? ullProcessedSize - m_ullProcessedSize : 0, m_tTimer.Modify().Tick()); m_ullProcessedSize = ullProcessedSize; _ASSERTE(m_ullProcessedSize <= m_ullTotalSize); @@ -252,7 +267,8 @@ m_ullCurrentItemProcessedSize.Modify() += fsDiff; m_ullProcessedSize.Modify() += fsDiff; - m_tSizeSpeed.Modify().AddSample(fsDiff, m_tTimer.Modify().Tick()); + if(!m_bIgnoreSizeSpeed) + m_tSizeSpeed.Modify().AddSample(fsDiff, m_tTimer.Modify().Tick()); } else { @@ -261,7 +277,8 @@ m_ullCurrentItemProcessedSize.Modify() -= fsDiff; m_ullProcessedSize.Modify() -= fsDiff; - m_tSizeSpeed.Modify().AddSample(0, m_tTimer.Modify().Tick()); + if(!m_bIgnoreSizeSpeed) + m_tSizeSpeed.Modify().AddSample(0, m_tTimer.Modify().Tick()); } VerifyProcessedVsTotal(); @@ -319,7 +336,8 @@ if (m_tTimer.Get().IsRunning()) { m_tTimer.Modify().Tick(); - m_tSizeSpeed.Modify().AddSample(0, m_tTimer.Get().GetLastTimestamp()); + if(!m_bIgnoreSizeSpeed) + m_tSizeSpeed.Modify().AddSample(0, m_tTimer.Get().GetLastTimestamp()); m_tCountSpeed.Modify().AddSample(0, m_tTimer.Get().GetLastTimestamp()); } } Index: src/libchengine/TSubTaskStatsInfo.h =================================================================== diff -u -r0d5b67ee96b435d63f7bf075dc8e28603793b187 -r9fcf462ad4a28203a3d34ded6da7125d4dcc925c --- src/libchengine/TSubTaskStatsInfo.h (.../TSubTaskStatsInfo.h) (revision 0d5b67ee96b435d63f7bf075dc8e28603793b187) +++ src/libchengine/TSubTaskStatsInfo.h (.../TSubTaskStatsInfo.h) (revision 9fcf462ad4a28203a3d34ded6da7125d4dcc925c) @@ -56,7 +56,7 @@ static const unsigned long long DefaultSpeedSampleTime = 100; // in miliseconds public: - explicit TSubTaskStatsInfo(ESubOperationType eSubTaskType); + explicit TSubTaskStatsInfo(ESubOperationType eSubTaskType, bool bIgnoreSizeSpeed = false); TSubTaskStatsInfo(const TSubTaskStatsInfo&) = delete; TSubTaskStatsInfo& operator=(const TSubTaskStatsInfo&) = delete; @@ -179,6 +179,7 @@ serializer::TSharedModificationTracker m_bIsInitialized; const ESubOperationType m_eSubOperationType; + bool m_bIgnoreSizeSpeed = false; #pragma warning(push) #pragma warning(disable: 4251) Index: src/libchengine/TSubTaskStatsSnapshot.cpp =================================================================== diff -u -r9ddf8fdd5f641491dd30c49eb90f8f740314b6af -r9fcf462ad4a28203a3d34ded6da7125d4dcc925c --- src/libchengine/TSubTaskStatsSnapshot.cpp (.../TSubTaskStatsSnapshot.cpp) (revision 9ddf8fdd5f641491dd30c49eb90f8f740314b6af) +++ src/libchengine/TSubTaskStatsSnapshot.cpp (.../TSubTaskStatsSnapshot.cpp) (revision 9fcf462ad4a28203a3d34ded6da7125d4dcc925c) @@ -98,10 +98,7 @@ double TSubTaskStatsSnapshot::GetSizeSpeed() const { - if(m_bSubTaskIsRunning) - return m_dSizeSpeed; - - return 0.0; + return m_dAvgSizeSpeed; } void TSubTaskStatsSnapshot::SetCountSpeed(double dCountSpeed) @@ -116,22 +113,6 @@ return 0.0; } - double TSubTaskStatsSnapshot::GetAvgSizeSpeed() const - { - if (m_timeElapsed) - return Math::Div64(m_ullProcessedSize, m_timeElapsed / 1000.0); - - return 0.0; - } - - double TSubTaskStatsSnapshot::GetAvgCountSpeed() const - { - if (m_timeElapsed) - return Math::Div64(m_fcProcessedCount, m_timeElapsed / 1000.0); - - return 0.0; - } - double TSubTaskStatsSnapshot::GetCombinedProgress() const { return CalculateProgress(); Index: src/libchengine/TSubTaskStatsSnapshot.h =================================================================== diff -u -r0d5b67ee96b435d63f7bf075dc8e28603793b187 -r9fcf462ad4a28203a3d34ded6da7125d4dcc925c --- src/libchengine/TSubTaskStatsSnapshot.h (.../TSubTaskStatsSnapshot.h) (revision 0d5b67ee96b435d63f7bf075dc8e28603793b187) +++ src/libchengine/TSubTaskStatsSnapshot.h (.../TSubTaskStatsSnapshot.h) (revision 9fcf462ad4a28203a3d34ded6da7125d4dcc925c) @@ -86,12 +86,14 @@ // speed void SetSizeSpeed(double dSizeSpeed); double GetSizeSpeed() const; + void SetAvgSizeSpeed(double dSizeSpeed) { m_dAvgSizeSpeed = dSizeSpeed; } + double GetAvgSizeSpeed() const { return m_dAvgSizeSpeed; } + void SetCountSpeed(double dCountSpeed); double GetCountSpeed() const; + void SetAvgCountSpeed(double dCountSpeed) { m_dAvgCountSpeed = dCountSpeed; } + double GetAvgCountSpeed() const { return m_dAvgCountSpeed; } - double GetAvgSizeSpeed() const; - double GetAvgCountSpeed() const; - ESubOperationType GetSubOperationType() const { return m_eSubOperationType; } void SetSubOperationType(ESubOperationType val) { m_eSubOperationType = val; } @@ -104,12 +106,14 @@ // subtask size and size speed per second unsigned long long m_ullTotalSize; unsigned long long m_ullProcessedSize; - double m_dSizeSpeed; + double m_dSizeSpeed = 0.0; + double m_dAvgSizeSpeed = 0.0; // subtask count of items and its speed per second file_count_t m_fcTotalCount; file_count_t m_fcProcessedCount; - double m_dCountSpeed; + double m_dCountSpeed = 0.0; + double m_dAvgCountSpeed = 0.0; // current item size unsigned long long m_ullCurrentItemTotalSize;