CalculateETA 1.3.0

Suggested Alternatives

CalculateETA 2.1.0

Additional Details

CalculateETA 1.1.0, 1.2.1, 1.3.0, 1.4.0, 1.5.0 and 1.6.0 versions might have critical bugs that may effect your calculations. Please update your package with 2.1.0

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package CalculateETA --version 1.3.0                
NuGet\Install-Package CalculateETA -Version 1.3.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CalculateETA" Version="1.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CalculateETA --version 1.3.0                
#r "nuget: CalculateETA, 1.3.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CalculateETA as a Cake Addin
#addin nuget:?package=CalculateETA&version=1.3.0

// Install CalculateETA as a Cake Tool
#tool nuget:?package=CalculateETA&version=1.3.0                

CalculateETA

CalculateETA is a project to calculate estimated time to arrive on loops whether it is in single-thread or multi-thread applicatons.

Check out on Nuget gallery

Description

CalculateETA has methods to calculate estimated time to finish on loops. It calculates left count of iteration and multiply it with avarage passed time on the loop. On multi-thread applications, it has internal counter that increases everytime methods works via using that calculating left count of loop and multiply it with avarage passed time on the loop.

CalculateETA is optimized for cpu-intense applications.

Listed Methods

Counter Process
ResetCounter()

ResetCounterUint()

Returns true (value was not zero and resetted) or false (value was zero already) value. (bool)

Single-thread methods

<sup>1</sup>

* CalcETA(int index, int totalIndex, long totalElapsedTimeInMs)
* CalcETAUnsafe(int index, int totalIndex, long totalElapsedTimeInMs)
* CalcETA(uint index, uint totalIndex, long totalElapsedTimeInMs)
* CalcETAUnsafe(uint index, uint totalIndex, long totalElapsedTimeInMs)

Returns null if any of parameter is zero or returns estimated left time in milliseconds (long?)

  • int/uint index: Current index of loop.

  • int/uint totalIndex: Total index of loop.

  • long totalElapsedTimeInMs: Passed time of loop in milliseconds.

<sup>2</sup>

* CalcETA(int index, int totalIndex, long totalElapsedTicks, long tickFrequency)
* CalcETAUnsafe(int index, int totalIndex, long totalElapsedTicks, long tickFrequency)
* CalcETA(uint index, uint totalIndex, long totalElapsedTicks, long tickFrequency)
* CalcETAUnsafe(uint index, uint totalIndex, long totalElapsedTicks, long tickFrequency)

Returns null if any of parameter is zero or returns estimated left time in milliseconds (long?)

  • int/uint index: Current index of loop.

  • int/uint totalIndex: Total index of loop.

  • long totalElapsedTicks: Passed ticks of loop.

  • long tickFrequency: Tick of frequency.

<sup>3</sup>

* CalcETA(int index, int totalIndex, TimeSpan timeSpan)
* CalcETAUnsafe(int index, int totalIndex, TimeSpan timeSpan)
* CalcETA(uint index, uint totalIndex, TimeSpan timeSpan)
* CalcETAUnsafe(uint index, uint totalIndex, TimeSpan timeSpan)

Returns null if any of parameter is zero or returns estimated left time in milliseconds (double?)

  • int/uint index: Current index of loop.

  • int/uint totalIndex: Total index of loop.

  • TimeSpan timeSpan: Passed time of loop in TimeSpan format.

Multi-thread methods

<sup>4</sup>

* CalcETA(int totalIndex, long totalElapsedTimeInMs)
* CalcETAUnsafe(int totalIndex, long totalElapsedTimeInMs)
* CalcETA(uint totalIndex, long totalElapsedTimeInMs)
* CalcETAUnsafe(uint totalIndex, longTotalElapsedTimeInMs)

Returns null if any of parameter is zero or returns estimated left time in milliseconds (long?)

  • int/uint index: Current index of loop.

  • long totalElapsedTimeInMs: Passed time of loop in milliseconds.

<sup>5</sup>

CalcETA(int totalIndex, long totalElapsedTicks, long tickFrequency)
CalcETAUnSafe(int totalIndex, long totalElapsedTicks, long tickFrequency)
CalcETA(uint totalIndex, long totalElapsedTicks, long tickFrequency)
CalcETAUnsafe(uint totalIndex, long totalElapsedTicks, long tickFrequency)

Returns null if any of parameter is zero or returns estimated left time in milliseconds (long?)

  • int/uint index: Current index of loop.

  • long totalElapsedTicks: Passed ticks of loop.

  • long tickFrequency: Tick of frequency.

<sup>6</sup>

* CalcETA(int totalIndex, TimeSpan timeSpan)
* CalcETAUnsafe(int totalIndex, TimeSpan timeSpan)
* CalcETA(uint totalIndex, TimeSpan timeSpan)
* CalcETAUnsafe(uint totalIndex, TimeSpan timeSpan)

Returns null if any of parameter is zero or returns estimated left time in milliseconds (double?)

  • int/uint index: Current index of loop.

  • TimeSpan timeSpan: Passed time of loop in TimeSpan format.

Visualization of output

TimeSpanETA(long? eTATimeInMs)

Returns Time.Zero if eTATimeInMs is null or negative or left time. (TimeSpan)

  • long?: Estimated time to finish in milliseconds.
NumberFormatETA(long? eTATimeInMs)

Returns "Uncalculatable" if eTATimeInMs is null, returns "Negative" if eTATimeInMs is negative, returns left time in {hh:mm:ss:msms}. (string)

  • long?: Estimated time to finish in milliseconds.
NameETA(long? eTATimeInMs)

Returns "Uncalculatable" if eTATimeInMs is null, returns "Negative" if eTATimeInMs is negative (string)

Returns {} ms, {} second(s), {} minute(s) and {} second(s), {} hour(s) and {} minute(s), or {} day(s) and {} hour(s)

  • long?: Estimated time to finish in milliseconds.

Example Usage

Single-Thread

<sup>1</sup>

CalcETA(5, 10, 1000) => (long)1000 

<sup>2</sup>

CalcETA(5, 20, 50000000, 10000000) => (long)15

<sup>3</sup>

CalcETA(5, 20, new TimeSpan(0, 0, 1, 5) => (double)195
Multi-Thread

<sup>4</sup>

CalcETA(10, 1000) => (long)1000 

<sup>5</sup>

CalcETA(20, 50000000, 10000000) => (long)15

<sup>6</sup>

CalcETA(20, new TimeSpan(0, 0, 1, 5) => (double)195
Output
TimeSpanETA(90000) => (TimeSpan)00:01:30
NumberFormatETA(90000) => "0:1:30:0"
NameETA(90000) => "1 minute(s) and 30 second(s)"

Version History

See commit change See release history See changelog

  • 1.3.0

    • Added support for uint data type as parameters.
    • Added unsafe methods for increase performance
  • 1.2.1

    • Output folder is renamed as OutputDLL
    • Ready-to-use CalculateETA.dll and CalculateETA.xml are updated.
  • 1.2.0

    • Fixed left time measurement bug.
    • When calculation left time TimeSpan is being used instead of conventional mathematical operations.
  • 1.1.0

    • Added ResetCounter() method for reset counter that holds int variable to calculate ETA on multi-thread applications
  • 1.0.0 Initial Release

Task list

  • Support Int64 (UInt) data type on CalcETA methods individually.
  • Support unsafe methods individually for better performance.
  • Usage of negative index values create corrupted data as result.

Licence

No licence is required.

Authors

Twitter: Enes Okullu @enesokullu

Help

Twitter: Enes Okullu @enesokullu

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0 99 5/6/2024
2.4.0 111 3/17/2024
2.3.0 118 1/18/2024
2.2.0 176 11/6/2023
2.1.1 128 10/18/2023
2.1.0 155 9/14/2023
2.0.0 208 8/27/2023
1.7.2 234 7/1/2023
1.7.0 201 6/17/2023
1.6.2 215 6/15/2023
1.6.1 199 6/14/2023

+ Fixing bug on time measurement and using TimeSpan to resolve of time.
+ day(s) division shows additionally hour(s) now.