OpenCV: cv::TickMeter Class Reference

| OpenCV 3.4.2 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 "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

## Constructor & Destructor Documentation

## ◆ TickMeter()

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

the default constructor

## Member Function Documentation

## ◆ getCounter()

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

returns internal counter value.

## ◆ getTimeMicro()

double cv::TickMeter::getTimeMicro | ( |  | ) | const
| inline

returns passed time in microseconds.

## ◆ getTimeMilli()

double cv::TickMeter::getTimeMilli | ( |  | ) | const
| inline

returns passed time in milliseconds.

## ◆ getTimeSec()

double cv::TickMeter::getTimeSec | ( |  | ) | const
| inline

returns passed time in seconds.

## ◆ getTimeTicks()

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

returns counted ticks.

## ◆ reset()

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

resets internal values.

## ◆ start()

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

starts counting ticks.

## ◆ stop()

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

stops counting ticks.

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

- core/include/opencv2/core/utility.hpp