Fix some printfs.
Add profiling code for traces.