profiling opencv code
using some macro magic, we can get execution profiles for functions / scope blocks.this will print out a table (calls, per-call, total, ticks) at the end of the program
#include "profile.h"
void solve() {
PROFILE; // uses function name
...
for (int i=0; i<100; i++) {
PROFILEX("solve.iter"); // labelled block scope
...
}
}
solve 20 0.001979 0.039581 83749
solve.iter 2000 0.002063 0.041269 87320
inv 1 2.213202 2.213202 4682832
main 1 2.365499 2.365499 5005072