2.0.0b10
catchment modelling framework
Loading...
Searching...
No Matches
StopWatch Class Reference

Detailed Description

A stopwatch to estimated the total time of a process  

Creating a StopWatch:
>>>stopwatch=StopWatch(start, stop)
Start and end are indicators to describe the progress of a process. 
Start is the indicator value at the beginning of the process. As default they are 0.0 and 1.0.

Starting the StopWatch again:
>>>stopwatch.restart()

Getting the elapsed time, the total time and the remaining time of the process in seconds:
>>>elapsed, total, remaining = stopwatch(progress)
Where progress is a process progress indicator matching start and stop 

Example:
stopwatch=StopWatch(0,10)
for i in range(10):
    time.sleep(1)
    print('elapsed = %0.2fs, total= %0.2fs, remaining = %0.2fs' % stopwatch(i+1))

Public Member Functions

 __call__ (self, progress)
 
 restart (self)
 

Member Function Documentation

◆ __call__()

__call__ ( self,
progress )
Returns the progress in wall clock time
:param progress: The current position in the stopwatch
:return: A 3-tuple of elapsed, total and remaining seconds of the task

◆ restart()

restart ( self)
Restarts the stopwatch