The Timer context could store its entering and exiting timestamps
Release notes
Timer now stores its entering and exiting timestamps.
Problem to solve
Measure the time spent between an event happening within a Timer context and the entering (and/or exiting) of this context.
Proposal
Store the entering and exiting timestamps a Timer context as attributes,
so that the user may access them and compare them with other timestamps retrieved within this context.
from gemseo.utils.timer import Timer
from datetime import datetime
with Timer() as timer:
...
milestone = datetime.now()
...
timedelta_to_milestone = milestone - timer.entering_datetime
timedelta_from_milestone = timer.exiting_datetime - milestone
Intended users
Developers and end-users.
User experience goal
The user can measure the time spent between an event happening within a Timer context and the entering (and/or exiting) of this context.
Further details
This features would be useful in gemseo-benchmark:
the execution of the algorithms happens within a Timer context,
and the time spent between the starting of the algorithm and each iteration needs to be measured.
This can be done by comparing the timestamp of each iteration and the entering timestamp of Timer.