1. std::chrono 사용하는 방법


#include <iostream>
#include <chrnono>

int main()
{
// 변수 생성 (밀리초 단위)
std::chrono::duration<double, std::milli> time;

// 시간 재기
std::chrono::system_clock::time_point start = std::chrono::system_clock::now(); // Timer starts
myFunc
std::chrono::system_clock::time_point end = std::chrono::system_clock::now(); // Timer starts
time = end - start;

std::cout << "Time taken for myFunc: "<< time.count() << " ms" << std::endl;
}

std::chrono::duration_cast

2. OpenCV 함수를 사용하는 방법


int64 time_start;
int64 time_end;
double time_process;

time_start = cv::getTickCount();

time_end = cv::getTickCount();
time_process = (time_end - time_start) / cv::getTickFrequency() * 1000.f;

printf("-- Main Thread - Processing time (ms) :  %3.4f \\r", time_process);