OpenCV  3.4.12-dev
Open Source Computer Vision
Public Member Functions | List of all members

a Class to measure passing time. More...

#include <opencv2/core/utility.hpp>

Public Member Functions

 TickMeter ()
 the default constructor More...
 
double getAvgTimeMilli () const
 returns average time in milliseconds More...
 
double getAvgTimeSec () const
 returns average time in seconds More...
 
int64 getCounter () const
 returns internal counter value. More...
 
double getFPS () const
 returns average FPS (frames per second) value. More...
 
double getTimeMicro () const
 returns passed time in microseconds. More...
 
double getTimeMilli () const
 returns passed time in milliseconds. More...
 
double getTimeSec () const
 returns passed time in seconds. More...
 
int64 getTimeTicks () const
 returns counted ticks. More...
 
void reset ()
 resets internal values. More...
 
void start ()
 starts counting ticks. More...
 
void stop ()
 stops counting ticks. More...
 

Detailed Description

a Class to measure passing time.

The class computes passing time by counting the number of ticks per second. That is, the following code computes the execution time in seconds:

tm.start();
// do something ...
tm.stop();
cout << "Total time: " << tm.getTimeSec() << endl;

It is also possible to compute the average time over multiple runs:

for (int i = 0; i < COUNT; i++)
{
tm.start();
// do something ...
tm.stop();
}
cout << "Average time per iteration in seconds: " << tm.getAvgTimeSec() << endl;
cout << "Average FPS: " << tm.getFPS() << endl;
See also
getTickCount, getTickFrequency
Examples:
samples/dnn/object_detection.cpp, and samples/dnn/text_detection.cpp.

Constructor & Destructor Documentation

◆ TickMeter()

cv::TickMeter::TickMeter ( )
inline
Python:
<TickMeter object>=cv.TickMeter()

the default constructor

Member Function Documentation

◆ getAvgTimeMilli()

double cv::TickMeter::getAvgTimeMilli ( ) const
inline
Python:
retval=cv.TickMeter.getAvgTimeMilli()

returns average time in milliseconds

◆ getAvgTimeSec()

double cv::TickMeter::getAvgTimeSec ( ) const
inline
Python:
retval=cv.TickMeter.getAvgTimeSec()

returns average time in seconds

◆ getCounter()

int64 cv::TickMeter::getCounter ( ) const
inline
Python:
retval=cv.TickMeter.getCounter()

returns internal counter value.

◆ getFPS()

double cv::TickMeter::getFPS ( ) const
inline
Python:
retval=cv.TickMeter.getFPS()

returns average FPS (frames per second) value.

◆ getTimeMicro()

double cv::TickMeter::getTimeMicro ( ) const
inline
Python:
retval=cv.TickMeter.getTimeMicro()

returns passed time in microseconds.

◆ getTimeMilli()

double cv::TickMeter::getTimeMilli ( ) const
inline
Python:
retval=cv.TickMeter.getTimeMilli()

returns passed time in milliseconds.

Examples:
samples/dnn/text_detection.cpp.

◆ getTimeSec()

double cv::TickMeter::getTimeSec ( ) const
inline
Python:
retval=cv.TickMeter.getTimeSec()

returns passed time in seconds.

◆ getTimeTicks()

int64 cv::TickMeter::getTimeTicks ( ) const
inline
Python:
retval=cv.TickMeter.getTimeTicks()

returns counted ticks.

◆ reset()

void cv::TickMeter::reset ( )
inline
Python:
None=cv.TickMeter.reset()

resets internal values.

Examples:
samples/dnn/text_detection.cpp.

◆ start()

void cv::TickMeter::start ( )
inline
Python:
None=cv.TickMeter.start()

starts counting ticks.

Examples:
samples/dnn/text_detection.cpp.

◆ stop()

void cv::TickMeter::stop ( )
inline
Python:
None=cv.TickMeter.stop()

stops counting ticks.

Examples:
samples/dnn/text_detection.cpp.

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