Fixed qsort() callback function.
Several changes:

- profile_buf renamed to struct __profile_buf
- the history of tests are in the heap.
- simplified output messages.