Improve messaging on startup/shutdown when profiling is enabled.

Should help fix #304
Merge remote-tracking branch 'upstream/master'