| OpenCV 3.4.7 Open Source Computer Vision

Public Member Functions | List of all members
cv::TickMeter Class Reference
Core functionality » Utility and system functions and macros

a Class to measure passing time. More...

`#include <opencv2/core/utility.hpp>`

## Public Member Functions
| TickMeter ()
| the default constructor More...
int64 | getCounter () const
double | getTimeMicro () const
double | getTimeMilli () const
double | getTimeSec () const
int64 | getTimeTicks () const
void | reset ()
void | start ()
void | stop ()

## 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:

TickMeter tm;
tm.start();
// do something ...
tm.stop();
std::cout << tm.getTimeSec();

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

TickMeter tm;
for (int i = 0; i < 100; i++)
{
tm.start();
// do something ...
tm.stop();
}
double average_time = tm.getTimeSec() / tm.getCounter();
std::cout << "Average time in second per iteration is: " << average_time << std::endl;

See also
  getTickCount, getTickFrequency

Examples:
  samples/dnn/object_detection.cpp.

## Constructor & Destructor Documentation

## § TickMeter()

cv::TickMeter::TickMeter | ( |  | ) |
| inline

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

the default constructor

## Member Function Documentation

## § getCounter()

int64 cv::TickMeter::getCounter | ( |  | ) | const
| inline

Python:
| retval | = | cv.TickMeter.getCounter( |  | )

returns internal counter 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.

## § 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.

## § start()

void cv::TickMeter::start | ( |  | ) |
| inline

Python:
| None | = | cv.TickMeter.start( |  | )

starts counting ticks.

## § stop()

void cv::TickMeter::stop | ( |  | ) |
| inline

Python:
| None | = | cv.TickMeter.stop( |  | )

stops counting ticks.

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

- opencv2/core/utility.hpp