|
@@ -846,6 +846,20 @@ unsigned int __fastcall TFileOperationProgressType::CPS()
|
|
return GetCPS();
|
|
return GetCPS();
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
//---------------------------------------------------------------------------
|
|
|
|
+inline static unsigned int CalculateCPS(__int64 Transferred, unsigned int MSecElapsed)
|
|
|
|
+{
|
|
|
|
+ unsigned int Result;
|
|
|
|
+ if (MSecElapsed == 0)
|
|
|
|
+ {
|
|
|
|
+ Result = 0;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ Result = (unsigned int)(Transferred * MSecsPerSec / MSecElapsed);
|
|
|
|
+ }
|
|
|
|
+ return Result;
|
|
|
|
+}
|
|
|
|
+//---------------------------------------------------------------------------
|
|
// Has to be called from a guarded method
|
|
// Has to be called from a guarded method
|
|
unsigned int __fastcall TFileOperationProgressType::GetCPS()
|
|
unsigned int __fastcall TFileOperationProgressType::GetCPS()
|
|
{
|
|
{
|
|
@@ -868,15 +882,8 @@ unsigned int __fastcall TFileOperationProgressType::GetCPS()
|
|
TimeSpan = (Ticks - FPersistence.Ticks.front());
|
|
TimeSpan = (Ticks - FPersistence.Ticks.front());
|
|
}
|
|
}
|
|
|
|
|
|
- if (TimeSpan == 0)
|
|
|
|
- {
|
|
|
|
- Result = 0;
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- __int64 Transferred = (FPersistence.TotalTransferred - FPersistence.TotalTransferredThen.front());
|
|
|
|
- Result = (unsigned int)(Transferred * MSecsPerSec / TimeSpan);
|
|
|
|
- }
|
|
|
|
|
|
+ __int64 Transferred = (FPersistence.TotalTransferred - FPersistence.TotalTransferredThen.front());
|
|
|
|
+ Result = CalculateCPS(Transferred, TimeSpan);
|
|
}
|
|
}
|
|
return Result;
|
|
return Result;
|
|
}
|
|
}
|
|
@@ -956,7 +963,7 @@ void __fastcall TFileOperationProgressType::UnlockUserSelections()
|
|
UnicodeString __fastcall TFileOperationProgressType::GetLogStr(bool Done)
|
|
UnicodeString __fastcall TFileOperationProgressType::GetLogStr(bool Done)
|
|
{
|
|
{
|
|
UnicodeString Transferred = FormatSize(TotalTransferred);
|
|
UnicodeString Transferred = FormatSize(TotalTransferred);
|
|
- UnicodeString Left;
|
|
|
|
|
|
+
|
|
TDateTime Time;
|
|
TDateTime Time;
|
|
UnicodeString TimeLabel;
|
|
UnicodeString TimeLabel;
|
|
if (!Done && TotalSizeSet)
|
|
if (!Done && TotalSizeSet)
|
|
@@ -970,7 +977,19 @@ UnicodeString __fastcall TFileOperationProgressType::GetLogStr(bool Done)
|
|
TimeLabel = L"Elapsed";
|
|
TimeLabel = L"Elapsed";
|
|
}
|
|
}
|
|
UnicodeString TimeStr = FormatDateTimeSpan(Configuration->TimeFormat, Time);
|
|
UnicodeString TimeStr = FormatDateTimeSpan(Configuration->TimeFormat, Time);
|
|
- UnicodeString CPSStr = FormatSize(CPS());
|
|
|
|
|
|
+
|
|
|
|
+ unsigned int ACPS;
|
|
|
|
+ if (!Done)
|
|
|
|
+ {
|
|
|
|
+ ACPS = CPS();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ unsigned int Elapsed = TimeToMSec(TimeElapsed());
|
|
|
|
+ ACPS = CalculateCPS(TotalTransferred, Elapsed);
|
|
|
|
+ }
|
|
|
|
+ UnicodeString CPSStr = FormatSize(ACPS);
|
|
|
|
+
|
|
return FORMAT(L"Transferred: %s, %s: %s, CPS: %s/s", (Transferred, TimeLabel, TimeStr, CPSStr));
|
|
return FORMAT(L"Transferred: %s, %s: %s, CPS: %s/s", (Transferred, TimeLabel, TimeStr, CPSStr));
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
//---------------------------------------------------------------------------
|