mirror of https://github.com/CGAL/cgal
66 lines
2.4 KiB
TeX
66 lines
2.4 KiB
TeX
% +------------------------------------------------------------------------+
|
|
% | CGAL Reference Manual: Real_timer.tex
|
|
% +------------------------------------------------------------------------+
|
|
|
|
\begin{ccRefClass}{Real_timer}
|
|
|
|
\ccDefinition
|
|
|
|
\ccInclude{CGAL/Real_timer.h}
|
|
\ccCreationVariable{t}
|
|
|
|
The class \ccRefName\ is a timer class for measuring real time.
|
|
A timer \ccVar\ of type \ccRefName\ is an object with a state. It is
|
|
either {\em running\/} or it is {\em stopped}. The state is controlled
|
|
with \ccStyle{t.start()} and \ccStyle{t.stop()}. The timer counts the
|
|
time elapsed since its creation or last reset. It counts only the time
|
|
where it is in the running state. The time information is given in seconds.
|
|
The timer counts also the number of intervals it was running, i.e. it
|
|
counts the number of calls of the \ccc{start()} member function since the
|
|
last reset. If the reset occures while the timer is running it counts as the
|
|
first interval.
|
|
|
|
\ccCreation
|
|
|
|
\ccSetThreeColumns{Timer&}{t.is_running();}{}
|
|
\ccPropagateThreeToTwoColumns
|
|
%\ccSetTwoColumns{Timer t( Timer r);}{}
|
|
|
|
\ccConstructor{Real_timer();}{state is {\em stopped.}}
|
|
|
|
\ccOperations
|
|
|
|
\ccMethod{void start();}{\ccPrecond state is {\em stopped}.}
|
|
\ccGlue
|
|
\ccMethod{void stop ();}{\ccPrecond state is {\em running}.}
|
|
\ccGlue
|
|
\ccMethod{void reset();}{reset timer to zero. The state is unaffected.}
|
|
\ccGlue
|
|
\ccMethod{bool is_running();}{\ccc{true} if the current state is running.}
|
|
|
|
\ccMethod{double time();}{real time in seconds, or 0 if the
|
|
underlying system call failed.}
|
|
\ccGlue
|
|
\ccMethod{int intervals();}{number of start/stop-intervals since
|
|
the last reset.}
|
|
\ccGlue
|
|
\ccMethod{double precision();}{smallest possible time step in seconds,
|
|
or -1 if the system call failed.}
|
|
\ccGlue
|
|
\ccMethod{double max();}{maximal representable time in seconds.}
|
|
|
|
\ccImplementation
|
|
|
|
|
|
The timer class is based in the C function \ccc{gettimeofday()} on
|
|
POSIX systems, the C function \ccc{_ftime()} on MS Visual C++,
|
|
the C function \ccc{ftime()} on Borland C++, and \ccc{time()}
|
|
on Metrowerks Codewarrior. The system calls to these
|
|
timers might fail, in which case a warning message will be issued
|
|
through the \cgal\ error handler and the functions return with the
|
|
error codes indicated above. The \ccc{precision} method computes the
|
|
precision dynamically at runtime at its first invocation.
|
|
|
|
|
|
\end{ccRefClass}
|