Memory Allocation Profiling is Managed Only!

People have been discovering that the VS Team System profiler can collect allocation data for an application.  It isn’t long after that they discover that it only works on managed code, not native.  Sadly, the documentation is not clear on this. The memory alloction profiling support in VSTS uses the profiler API provided by the CLR. …


How to shoot yourself in the foot with const (or the lack thereof)

It has long puzzled me why various Win32 functions take non-const string parameters, when clearly they have no business manipulating the string.  Take, for instance, GetNamedSecurityInfo: DWORD GetNamedSecurityInfo( LPTSTR pObjectName, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, PSID* ppsidOwner, PSID* ppsidGroup, PACL* ppDacl, PACL* ppSacl, PSECURITY_DESCRIPTOR* ppSecurityDescriptor ); I can’t imagine why this function should ever need to…


DataCollection at the Global Level

If you are using the DataCollection API (either from native, by linking agains VSPerf.lib, or from managed, by importing Microsoft.VisualStudio.Profiler.dll), and wish to enable or disable collection at the global level, you must pass CurrentId for the elementId parameter:   using Microsoft.VisualStudio.Profiler;   [Not so interesting code here]     DataCollection.StartProfile(      ProfileLevel.Global,       DataCollection.CurrentId);   [Interesting…


Response Files

On the forums, someone was using the /INCLUDE option in VsInstr.exe.  It is possible to use multiple instances of this option to include different sets of functions.  For a big chunk of functions, you might want to use dozens of function specifications.  Who the heck wants to do all that typing?  You could make a…


Off-road Profiling Windows Services

I’ve just posted an article on the pitfalls of profiling services with the Visual Studio profiler.  It includes a sample service with a quick walkthrough.  Enjoy. Profiling Windows™ Services with the Visual Studio Profiler


Offroad Profiling: The Visual Studio Profiler and Windows™ Services

Introduction The Visual Studio Team System Profiler primarily addresses stand alone application scenarios.  However, more and more modern applications are built around a distributed architecture, and larger and larger portions of functionality are moving into remote services.  Of course, this is nothing new — multi-tier applications have been the norm for some time – but…


Limiting the Data Crunch from Trace Profiling

Typically, one can use the sampling profiler to nail down the hot spot in an application.  Having done that, what does one do when the sampling data doesn’t provide enough information?  The trace profiler can offer up more detail, particularly if the issue revolves around thread interaction.  However, if you profile a heavily CPU bound…


Trying out the profiler on the VPC

I’ve frequently heard the question asked, “Can I use the profiler on a Virtual PC?”  It has even come up on the blog feedback a few times.  My answer has always been, “Theoretically, yes.”  I didn’t want to post this answer externally until I’d actually gotten around to trying it myself. I’ve finally been nagged…


VPC and the BSOD (part 2)

I had a nice long email chat with members of the Virtual PC team. The good news:  The Virtual PC emulates the host processor well enough that our kernel-mode driver can detect what features are enabled. The bad news:  The Virtual PC does not emulate an APIC or performance counters. So, if you were planning on running…


VPC and the BSOD

I’m so pleased.  Someone did something exciting and dangerous with the profiler.  In case you’re not reading the newsgroups, an intrepid customer tried to profile on a Virtual PC, and discovered that it only leads to pain and misery via the BSOD. So don’t do that. Seriously, is this something people want to do?  I…