|
|
Calling the member function system() is analogous to reading the SYSTEM display; calling user() is analogous to reading the USER display, and calling real() is analogous to reading the REAL display. Reading operations may be performed at any time, regardless of whether the Stopwatch is running or not. For convenience and portability, the reading operations return double precision values in units of seconds.
Stopwatch w; w.start(); computation of interest w.stop(); cout << "user time = " << w.user() << "\ n";
As with the setting operations, each reading operation also incurs a certain overhead. Reading any display on a stopped Stopwatch incurs (at worst) the overhead of a function call; reading any display on a moving Stopwatch always incurs a system call.