OpenCV  4.10.0
Open Source Computer Vision
Loading...
Searching...
No Matches
Public Member Functions | List of all members

a Class to measure passing time. More...

#include <opencv2/core/utility.hpp>

Collaboration diagram for cv::TickMeter:

Public Member Functions

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

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;
a Class to measure passing time.
Definition utility.hpp:295
void start()
starts counting ticks.
Definition utility.hpp:304
double getTimeSec() const
returns passed time in seconds.
Definition utility.hpp:339
void stop()
stops counting ticks.
Definition utility.hpp:310

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;
double getFPS() const
returns average FPS (frames per second) value.
Definition utility.hpp:351
double getAvgTimeSec() const
returns average time in seconds
Definition utility.hpp:360
See also
getTickCount, getTickFrequency
Examples
samples/dnn/classification.cpp, and samples/dnn/object_detection.cpp.

Constructor & Destructor Documentation

◆ TickMeter()

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

the default constructor

Member Function Documentation

◆ getAvgTimeMilli()

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

returns average time in milliseconds

◆ getAvgTimeSec()

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

returns average time in seconds

◆ getCounter()

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

returns internal counter value.

◆ getFPS()

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

returns average FPS (frames per second) value.

◆ getTimeMicro()

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

returns passed time in microseconds.

◆ getTimeMilli()

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

returns passed time in milliseconds.

Examples
samples/dnn/classification.cpp.

◆ getTimeSec()

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

returns passed time in seconds.

Here is the call graph for this function:

◆ getTimeTicks()

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

returns counted ticks.

◆ reset()

void cv::TickMeter::reset ( )
inline
Python:
cv.TickMeter.reset() -> None

resets internal values.

Examples
samples/dnn/classification.cpp.

◆ start()

void cv::TickMeter::start ( )
inline
Python:
cv.TickMeter.start() -> None

starts counting ticks.

Examples
samples/dnn/classification.cpp.
Here is the call graph for this function:

◆ stop()

void cv::TickMeter::stop ( )
inline
Python:
cv.TickMeter.stop() -> None

stops counting ticks.

Examples
samples/dnn/classification.cpp.
Here is the call graph for this function:

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