I'm going to make this short and sweet - there's not much [non-Polish (?!) ] documentation out there for nProf, so here are my notes for getting it to hook into your ASP.Net 2 app and show you some bottleneckage:
Preparation:
1. Set processModel username:
Open your machine.config file (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config), hit Ctrl+I (incremental search) and type processModel, hit F3 (~2 times) until you find the <processModel...> tag. Add the userName attribute within it: userName="SYSTEM"
2. Make sure your app is hosted in and accessible via IIS (nProf won't hook into Cassini) - ex: http://localhost/test
Install nProf:
There are a bunch of versions available, and they're all alphas... The one that worked for me is here (nprof-0.9.1-setup.exe on sourceforge).
Install the .exe, and when prompted go ahead and run nProf.
Profiling:
Note: DO NOT stop profiling via nProf. Instead, recycle your app pool, or restart IIS inside your IIS manager. nProf will see it's recycled and stop for you. If you use nProf's stop buttons, it will hang and you'll lose your profile data.
File > New, Create Profiler Project dialog opens, select ASP.NET radio button, click Create Project.
Click Project > Start Project Run (or just hit F5)
Open browser, browse to IIS-hosted asp.net app (use IIS address, ex, http://localhost/nProfTest). Browse through pages that are slow, or save separate profiles for individual pages. You will see nProf's Messages window start rolling with information.
Once again, don't click 'Stop Run' in nProf! Instead, go to IIS Manager, and either recycle your app pool, or restart IIS. This will properly stop nProf, and you will see your resulting profile data.
Analysis:
Back in nProf, you will see the threads called by your aspnet_wp.exe process, and when you select them, you will see the used namespace hierarchy below. Find the thread with your library profile. Uncheck the parent namespaces and re-check your own. On the right, you will see the method signatures called, number of times called, % time taken, and more. Click the '% of Total' header to sort, and you will see your bottleneck methods at the top.
Note: Saving & Opening is kludgy: You can try to save, but I've had no luck re-opening my profiles... instead I took a screenshot of my trouble methods just for reference.
Print | posted on Friday, September 14, 2007 10:15 AM