JeVois  1.21
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches

#include <jevois/Debug/Timer.H>

Simple timer class.

This class reports the time spent between start() and stop(), at specified intervals. Because JeVois modules typically work at video rates, this class only reports the average time after some number of iterations through start() and stop(). Thus, even if the time of an operation between start() and stop() is only a few microseconds, by reporting it only every 100 frames one will not slow down the overall framerate too much. See Profiler for a class that provides additional checkpoints between start() and stop().

Definition at line 34 of file Timer.H.

Public Member Functions

 Timer (char const *prefix, size_t interval=100, int loglevel=LOG_INFO)
 Constructor.
 
void start ()
 Start a time measurement period.
 
std::string const & stop (double *seconds)
 End a time measurement period, report time spent if reporting interval is reached.
 
std::string const & stop ()
 Same as the other signature of stop() except does not provide seconds, for python bindings.
 

Constructor & Destructor Documentation

◆ Timer()

jevois::Timer::Timer ( char const *  prefix,
size_t  interval = 100,
int  loglevel = LOG_INFO 
)

Constructor.

Definition at line 29 of file Timer.C.

References LFATAL.

Member Function Documentation

◆ start()

void jevois::Timer::start ( )

Start a time measurement period.

Definition at line 40 of file Timer.C.

◆ stop() [1/2]

std::string const & jevois::Timer::stop ( )

Same as the other signature of stop() except does not provide seconds, for python bindings.

Definition at line 140 of file Timer.C.

◆ stop() [2/2]

std::string const & jevois::Timer::stop ( double *  seconds)

End a time measurement period, report time spent if reporting interval is reached.

The fps and cpu load are returned, in case users want to show this info, eg, in an overlay display. Note that the values are only updated when the reporting interval is reached, and remain the same in between. If seconds is not null, it will be set to the instantaneous number of seconds between start() and stop().

Definition at line 47 of file Timer.C.

References LDEBUG, LERROR, LFATAL, LINFO, and jevois::secs2str().


The documentation for this class was generated from the following files: