colossalai.utils.timer
- class colossalai.utils.timer.Timer[source]
A timer object which helps to log the execution times, and provides different tools to assess the times.
- stop(keep_in_history=False)[source]
Stop the timer and record the start-stop time interval.
- Parameters:
keep_in_history (bool, optional) – Whether does it record into history each start-stop interval, defaults to False.
- Returns:
Start-stop interval.
- Return type:
int
- get_history_mean()[source]
Mean of all history start-stop time intervals.
- Returns:
Mean of time intervals
- Return type:
int
- get_history_sum()[source]
Add up all the start-stop time intervals.
- Returns:
Sum of time intervals.
- Return type:
int
- class colossalai.utils.timer.MultiTimer(on=True)[source]
An object contains multiple timers.
- Parameters:
on (bool, optional) – Whether the timer is enabled. Default is True.
- stop(name, keep_in_history)[source]
Stop namely one of the timers.
- Parameters:
name (str) – Timer’s key.
keep_in_history (bool) – Whether does it record into history each start-stop interval.