Make it safe to turn off/on profiling timer in code
Merge pull request #4541 from JuliaLang/teh/profile

Make it safe to turn off/on profiling timer in code