stopwatch
|
 |
An os_stopwatch
supports traditional stopwatch facilities and is useful for timing operations
and general benchmarking. Although a stopwatch stores its start and stop times
to microsecond levels, the inherent delays due to operating system paging and
context switching tend to make stopwatches accurate only to 1 second.
Declaration
#include <ospace/time/stopwtch.h>
class os_stopwatch
Interface
Constructor
os_stopwatch()
Constructs a reset
stopwatch that is not yet running.
Constructor
os_stopwatch(
const os_stopwatch& stopwatch )
Constructs a copy of stopwatch
.
=
os_stopwatch&
operator=( const os_stopwatch& stopwatch
)
Assigns stopwatch from stopwatch
.
==
bool
operator==( const os_stopwatch& stopwatch
) const
Returns true
if stopwatch is in the same state as stopwatch .
lap
os_time_period
lap() const
Returns the current
accumulated time period without affecting whether or not the stopwatch is
running.
(os_time_period)
operator
os_time_period() const
Returns a time period.
print
void
print( ostream& stream )
const
Prints to stream
.
reset
void
reset()
Resets the stopwatch to a
time period of zero seconds and stops the stopwatch if it is running.
running
bool
running() const
Returns true
if the stopwatch is running.
start
void
start()
Starts the stopwatch.
stop
void
stop()
Stops the stopwatch.
Non-Member Functions
<<
ostream&
operator<<( ostream& stream ,
const os_stopwatch& watch )
Prints watch
to stream .
Universal Streaming Service
#include <ospace/uss/time.h>
<<
os_bstream&
operator<<( os_bstream& stream ,
const os_stopwatch& watch )
Writes watch
to stream .
>>
os_bstream&
operator>>( os_bstream& stream ,
os_stopwatch& watch )
Reads watch
from stream .
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only.