pragma Elaborate_Body;
|
Known child units
|
Exceptions
|
Type Summary
|
Other Items:
|
type Stop_Watch is tagged private;
|
Tagged for two reasons:
- I want it to be a pass-by-reference type
- I want to allow future extensions. One possible
extension is to add a name to a stop watch. (See child package
Named .)
Any Stop_Watch is initially reset to zero and isn't running.
|
|
procedure Reset
(Watch : in out Stop_Watch);
|
Stops a running stop watch and resets it to zero.
|
|
procedure Start
(Watch : in out Stop_Watch);
|
Starts the stop watch. Raises Stop_Watch_Error if the
Watch it is already running.
|
|
procedure Stop
(Watch : in out Stop_Watch);
|
Stops a running stop watch. If the Watch is not running,
nothing happens.
|
|
function Elapsed
(Watch : in Stop_Watch)
return Duration;
|
Returns the accumulated elapsed time since the last Reset .
Raises Stop_Watch_Error if the Watch is running.
|
|
function Nof_Timings
(Watch : in Stop_Watch)
return Natural;
|
Returns the number of timings, i.e., the number of calls to
Start that didn't raise an exception since the last
call to Reset .
|
|
function Average
(Watch : in Stop_Watch)
return Duration;
|
Returns Elapsed / Nof_Timings ; raises Stop_Watch_Error
if Nof_Timings is zero or if the Watch is running.
|
|
|
private
|