Duration Class

Duration objects can be created in one of the following ways:

  • Through the constructor for the class.
  • Through the new operator.
  • By calling the durationFactory member function of the Listener object. However, the Listener does not keep a pointer to the objects returned by the durationFactory member function. Therefore, objects that are created in this manner must be deleted when they are no longer used.

For more information about the creation and usage of Durations, see the topics in the section Measuring Elapsed Time with Durations.

Constructor

durationFactory
Creates a Duration object at the top level of the Listener.

Member Functions

start
Indicates the beginning of the time interval that is to be measured (accumulated).
stop
After the recording interval completes, stop is called to calculate the time that is passed since start was called. The elapsed time (nanoseconds) is recorded to the current Accumulator and returned by this function. In addition, stop can be called in a manner that causes the value of the associated Event counter to be incremented as well.

See Also