Improve the speed of using COMPlus_JitTimeLogCsv (#49798)
authorBruce Forstall <brucefo@microsoft.com>
Fri, 19 Mar 2021 00:21:15 +0000 (17:21 -0700)
committerGitHub <noreply@github.com>
Fri, 19 Mar 2021 00:21:15 +0000 (17:21 -0700)
commit2b2ebba1c6cae7a1cc9cae90a5bd55f63f67d678
treefe64829846b941db2b64332c1d016b2e0bcbe834
parentfdaeaeb11a3f19b65e7568fbbb03fef56b39e046
Improve the speed of using COMPlus_JitTimeLogCsv (#49798)

* Improve the speed of using COMPlus_JitTimeLogCsv

I noticed that setting this and running a superpmi replay
was super slow. (Btw, note that you must use `--sequential`
in the scenario to avoid parallel writes to the log file).

This change fixes this in a number of ways:
1. The `CycleTimer::CyclesPerSecond()` function does not-trivial
computation to compute its answer. So cache the result.
2. It's expensive to constantly open and close the output file
(once per function). Partially, this is because anti-virus seems to
get involved. So open it once, and keep it open until the JIT
process is shut down.
3. Avoid calling `eeGetMethodFullName()` in DEBUG builds. (Note that
JitTimeLogCsv collects interesting information beyond just per-phase
timings that are also useful for extracting from a CSV file.)

* Fix CachedCyclesPerSecond logging

* Fix clang build break
src/coreclr/jit/compiler.cpp
src/coreclr/jit/compiler.h
src/coreclr/jit/inline.cpp
src/coreclr/jit/utils.cpp
src/coreclr/jit/utils.h