How do I get milliseconds time of execution of a piece of code in Qt/C++?
Use the QTime
class. Start it with .start()
(or .restart()
) and then check the amount of milliseconds passed with .elapsed()
. Naturally, the precision ultimately depends on the underlying OS, although with the major platforms you should have no trouble getting a real millisecond resolution.