Code clean up and profiling logs.

The main loop is more clear.

We measure the time spent in progress and rendering and log it if it is higher
than the allowed time window.
Remove the useless call to glFlush().