Ngen and Profiling

I am trying to use NGen to see if my application’s native images work better than .NET. However, I have a bit of trouble figuring out what to do.

My application is called MyApp.exe and has several dependency libraries.

I opened the VS 2010 command prompt and ran:

ngen install MyApp.exe /Profile 

The output from the command did not suggest that there were problems.

Then I switched to C: \ Windows \ assembly to try to run the EXE, but I could not find it (I am on Windows 7). A little bit about digging told me to use the command line to view in C: \ Windows \ assembly \ NativeImages_v4.0.30319_32. In the end, I was able to find my MyApp.ni.exe file, but, of course, I could not open the containing folder in Explorer.

I tried to run the program and they told me:

"C: \ Windows \ assembly \ NativeImages_v4.0.30319_32 ... \ MyApp.ni.exe is not a valid Win32 application."

The command output indicated by Access is rejected.

I had two questions:

  • How to run this program so that I can run my own version.
  • How can I profile it? It seems that I can not find this folder from the VS2010 profiler, because it can not be seen in Explorer.

Thanks.

+6
source share
1 answer

Looks like I should have read a little more. It looks like I can just execute the EXE that was transferred to NGEN, and it should automatically load the native material from the cache.

Another problem is that I had to run ngen with the / profile and / debug flags to make sure that I can do both.

This is a good tutorial on the problem:

http://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-getting-started-with-ngen-in-visual-studio.aspx

+1
source

Source: https://habr.com/ru/post/891310/


All Articles