This is the first part of time tracing system, I have splitted them cause this part is mostly written by Aras Pranckevicius except of several minor fixes concerning formatting. I'm to commit this in behalf of Aras, we have an arrangment with him.
The second part extends this option adding terminal output making no need for profiling visualization. I can also add xray support though this need is arguable.
The third part is for cleaning up previous attempts of such implementations (like https://reviews.llvm.org/D45619, https://reviews.llvm.org/D43578 and https://reviews.llvm.org/D47196).
This is taken from GitHub PR: https://github.com/aras-p/llvm-project-20170507/pull/2
Here is cfe maillist subject discussion: http://lists.llvm.org/pipermail/cfe-dev/2019-January/060836.html
This isn't covered by any timer; if you look in BackendUtil.cpp,
EmitAssemblyHelper actually has CodeGenerationTime("codegen", "Code Generation Time") timer.