I'm looking for the equivalent in Qt to GetTickCount()
Something that will allow me to measure the time it takes for a segment of code to run as in:
uint start = GetTickCount();
// do something..
uint timeItTook = GetTickCount() - start;
any suggestions?
I think it's probably better to use QElapsedTimer
since that is why the class exists in the first place. It was introduced with Qt 4.7. Note that it is also immuned to system's clock time change.
Example usage:
#include <QDebug>
#include <QElapsedTimer>
...
...
QElapsedTimer timer;
timer.start();
slowOperation(); // we want to measure the time of this slowOperation()
qDebug() << timer.elapsed();