Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide

RWTimer

Module:  Essential Tools Module   Group:  Miscellaneous


Does not inherit

Local Index

Members

Synopsis

#include <rw/timer.h>
RWTimer timer;

Description

This class can measure elapsed CPU (user) time. The timer has two states: running and stopped. The timer measures the total amount of time spent in the "running" state since it was either constructed or reset.

The timer is put into the "running" state by calling member function start(). It is put into the "stopped" state by calling stop().

RWTimer uses the system-dependent function clock(), which returns the number of "ticks" since it was first called. As a result, RWTimer cannot measure intervals longer than some system-dependent value. (For instance, on several common UNIX systems, this value is just under 36 minutes.)

Persistence

None

Example

This example prints out the amount of CPU time used while looping for 5 seconds (as measured using class RWTime).

Program output (exact value may differ):

Public Constructor

RWTimer();

Public Member Functions

double
elapsedTime() const;
void
reset();
void
start();
void
stop();


Previous fileTop of DocumentContentsIndex pageNext file

©2004 Copyright Quovadx, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.