mercredi 4 septembre 2019

Why is running time measured by Visual Studio Debug tool and chrono::high_resolution_clock so different?

I want to test running time of my code, so I use std::chrono::high_resolution_clock::now() to get current time. Time duration measured this way is roughly 45ms. However, when I try to measure with visual studio debug tool, it shows the duration between two break points is only roughly 7ms. Which one is the accurate time, or am I doing it right?

I'm working on Windows10 with visual studio2019, C++11.

// acquire images auto start_acquiring = std::chrono::high_resolution_clock::now(); // break point 1

/* some code*/

auto start_tracking = std::chrono::high_resolution_clock::now(); break point 2 std::chrono::duration time_acquiring = start_tracking - start_acquiring; std::cout << "time on acquiring camera " << ": " << time_acquiring.count() << std::endl;

Aucun commentaire:

Enregistrer un commentaire