CalculateETA is a project to calculate estimated time to arrive on loops whether it is in single-thread or multi-thread applicatons.
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.
ResetCounter()
Returns true (value was not zero and resetted) or false (value was zero already) value. (bool)
1
CalcETA(int index, int totalIndex, long totalElapsedTimeInMs)
Returns null if any of parameter is zero or returns estimated left time in milliseconds (long?)
-
int index: Current index of loop.
-
int totalIndex: Total index of loop.
-
long totalElapsedTimeInMs: Passed time of loop in milliseconds.
2
CalcETA(int index, int totalIndex, long totalElapsedTicks, long tickFrequency)
Returns null if any of parameter is zero or returns estimated left time in milliseconds (long?)
-
int index: Current index of loop.
-
int totalIndex: Total index of loop.
-
long totalElapsedTicks: Passed ticks of loop.
-
long tickFrequency: Tick of frequency.
3
CalcETA(int index, int totalIndex, TimeSpan timeSpan)
Returns null if any of parameter is zero or returns estimated left time in milliseconds (double?)
-
int index: Current index of loop.
-
int totalIndex: Total index of loop.
-
TimeSpan timeSpan: Passed time of loop in TimeSpan format.
4
CalcETA(int totalIndex, long totalElapsedTimeInMs)
Returns null if any of parameter is zero or returns estimated left time in milliseconds (long?)
-
int index: Current index of loop.
-
long totalElapsedTimeInMs: Passed time of loop in milliseconds.
5
CalcETA(int totalIndex, long totalElapsedTicks, long tickFrequency)
Returns null if any of parameter is zero or returns estimated left time in milliseconds (long?)
-
int index: Current index of loop.
-
long totalElapsedTicks: Passed ticks of loop.
-
long tickFrequency: Tick of frequency.
6
CalcETA(int totalIndex, TimeSpan timeSpan)
Returns null if any of parameter is zero or returns estimated left time in milliseconds (double?)
-
int index: Current index of loop.
-
TimeSpan timeSpan: Passed time of loop in TimeSpan format.
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.
1
CalcETA(5, 10, 1000) => (long)1000
2
CalcETA(5, 20, 50000000, 10000000) => (long)15
3
CalcETA(5, 20, new TimeSpan(0, 0, 1, 5) => (double)195
4
CalcETA(10, 1000) => (long)1000
5
CalcETA(20, 50000000, 10000000) => (long)15
6
CalcETA(20, new TimeSpan(0, 0, 1, 5) => (double)195
TimeSpanETA(90000) => (TimeSpan)00:01:30
NumberFormatETA(90000) => "0:1:30:0"
NameETA(90000) => "1 minute(s) and 30 second(s)"
See commit change See release history See changelog
-
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
- 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.
No licence is required.
Twitter: Enes Okullu @enesokullu
Twitter: Enes Okullu @enesokullu