20 #include "SheafSystem/stop_watch.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/std_iostream.h" 37 invariance(_start_time <= _stop_time);
91 _start_time = clock();
108 _stop_time = clock();
110 _cumulative_time +=
time();
129 double ldiff = (double) (_stop_time - _start_time);
138 result = (ldiff / CLOCKS_PER_SEC) * 1000.0;
142 result = ldiff / CLOCKS_PER_SEC;
169 return _cumulative_time;
183 _lap_times.push_back(
time());
184 _start_time = _stop_time;
203 require((0 <= xi) && (xi <=
lap_ct()));
207 result = _lap_times[xi];
230 result = _lap_times.size();
251 _cumulative_time = 0;
271 xos <<
" lap times: ";
273 for(
size_t i=0; i<xsw.
lap_ct(); ++i)
276 if((i % 10 == 9) || (i == (xsw.
lap_ct() - 1)))
void stop()
Marks the end of an interval.
double cumulative_time() const
The accumulated time in seconds between start()'s and stop()'s since the last reset().
double lap_time(int i) const
The length in seconds of the xi-th lap.
size_t lap_ct() const
The number of laps that have be marked.
void reset()
Clears the lap times and sets lap_ct() to 0.
stop_watch()
Default constructor.
time_unit
The unit of time to return.
void mark_lap()
Marks the end of the current lap.
virtual ~stop_watch()
Destructor.
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const dof_descriptor_array &p)
Insert dof_descriptor_array& p into ostream& os.
void start()
Marks the start of an interval.
double time(time_unit xunit=SECONDS) const
The length of the current interval.
virtual bool invariant() const
Class invariant.
A clock for timing intervals.