.NET Application JIT Time Measurement

I know that you can use NGen to create your own precompiled images of your .NET application.

But how do you rate how much time your application spent in JIT? What profiling tools will measure this? Are there any free tools that do this? I would like to know how much time you need to save before doing this.

+4
source share
2 answers

This article on measuring the impact of JIT has been very helpful. Basically you would use NGen for warm start scripts. Cold start times usually prevail when loading a DLL into memory. Compiling JIT has a much greater impact on a warm start.

This is fuzzy information on how to install xperf: basically you want to download the Windows 7.NET 4 SDK and do not forget to select the Performance Toolkit. Then open the VS 2010 command prompt as an administrator, navigate to the directory of the program you want to profile, and follow the commands in this article.

The main point is that when you capture xperf, you can go to the process and see how much time was spent on clrjit.dll. In my case, 30% of the CPU time was spent on a warm start.

+3
source

Unfortunately, there are no statistics "Absolute time in JIT" which you can receive. The CLR detects the performance counter "% time in Jit", which is periodically updated, but it is as accurate as the selection.

You can easily access this performance counter using the Performance Monitor Windows tool or using tools such as the RedGate ANTS Profiler, which is how I was first open to it. If you need programmatic access to it, you can use WMI or the .NET PerformanceCounter class.

+3
source

All Articles