Addendum: Getting that Profiler to Profile

So, I left out one detail of use in the last post that have gotten me a couple of instances of the same rather pointed question:

How exactly do you get the profiler to work with XNA GS 4.0?

ProfilerVariableTrue, it doesn’t work out of the box, or to be more accurate, CLR v4 doesn’t like CLR Profiler v2. For more information on this, refer to David Broman’s article on the topic. It’s a bit confusing if you, like me, are not really versed in the world of profiling. But it’s not so bad if you do a little quick internet research. Or you could just read on to see what I found out myself:

CLR v4 is backwards-compatible with V2(more or less), but it isn’t turned on by default. There are two things you need to do  to get the CLR profiler working with XNA/.NET 4.0. First, since you are almost certainly on Vista or Windows 7, set CLR profiler to run as administrator, or it won’t attach properly. Secondly, an environment variable needs setting. On Win7, the easiest way to do this is open the Start Menu, right-click on “Computer” and select “Properties…”. From there, open the advanced settings in the sidebar, click on “Environment Variables…” and add a new variable named “COMPLUS_ProfAPI_ProfilerCompatibilitySetting” with a value of “EnableV2Profiler”. This will tell CLR V4 to play nice with the V2 profiler.

This entry was posted in WP7, XNA. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *