Execution time of the particular function
-
You can use "QElapsedTimer":http://doc.qt.nokia.com/latest/qelapsedtimer.html or "Q_BENCHMARK":http://doc.qt.nokia.com/latest/qtest.html#QBENCHMARK of the "QtTest":http://doc.qt.nokia.com/latest/qtest.html module, which allows for measuring various performance metrics (Walltime, tick counter, Valgrind/Callgrind, Event Counter).
-
"QTime":http://doc.qt.nokia.com/latest/qtime.html#elapsed should do the trick too.
-
What is your ultimate goal? Do you want to hunt for bottlenecks in your application, or are you actually interested in the time a function took at runtime when the application is on your user's machine? In the first case, I suggest you use a tool like valgrind instead. In the second case, QTime will do just fine. Just do something like this:
@
QTime timer;
timer.start()
myLongFunction();
int runtime = timer.elapsed(); //gets the runtime in ms
@