Class used to keep track how much time is spent for a specific operation. Timers are primarily used to display info about performance. A timer is started at the beginning of a function and is stopped at the end of that function (special care needed when there are multiple return commands in a function because the status of unstopped timers is undefined). A timer also stores how many times the timer has been started so average time spent in a function can be computed.
When a timer is used in a recursive function it will typically be started multiple times. Timer class will only measure the time spent in the first call. This is done by counting how many times a timer is started and time spent is computed only when the number of stop() calls evens out the start() calls. It is the programmer's responsibility to make sure each start() is stopped by a stop() call.
Each timer may be associated with a timeout limit. This means that time spent between start() and stop() calls should be less than the timeout specified. Timeouts will only be checked when check() function is called. If check() function is not called setting timeouts has no effect. It is up to the programmer to decide when and how many times a timer will be checked.
There may be a dependency between timers. For example, classification, realization and entailment operations all use consistency checks. If something goes wrong inside a consistency check and that operation does not finish in a reasonable time, the timeout on the parent timer may expire. To handle such cases, a timer may be associated with a parent timer so every time a timer is checked for a timeout, its parent timer will also be checked. Normally, we would like to associate many parents with a timer but for efficiency reasons (looping over an array each time is expensive) each timer is allowed to have only one parent.
{@link Timers Timers} class stores a set of timers and provides functions to start, stop andcheck timers.
@see Timers @author Evren Sirin
|
|
|
|
|
|