Working with the Data Collection API in sampling mode

In previous blogs we’ve talked about using the Data Collection API to limit the amount of data that you collect in instrumentation mode. I’ve been asked recently if the Data Collection API can work with sampling mode as well as instrumentation mode.


The answer is yes, but in a limited fashion. Normally with the Data Collection API you can specify starting and stopping profiling at global, thread or process levels. But in sampling mode, you can only use global level to control profiling. For managed just add a reference to Microsoft.VisualStudio.Profiler.dll and use the DataCollection namespace. And for native code include VSPerf.h and use the functions defined in there.


Comments (2)

  1. I know this is entirely OT (sorry!), but I’ve got a question which has been bothering me for a while.  I’m looking for a good profiler to use on Windows which is akin to Mac OS X’s Shark utility.  My large-scale project is all in C++ and the dev work is done in Code Warrior (so using the Visual Studio profiler isn’t an option).  I’ve peeked at Intel’s vTune, and it’s a monster.  I’m just looking for something to give me simple sampling results — preferably something I can attach to a running process instead of having to bake into the source code.

    Do you have any suggestions?

  2. Lots of people are blogging about Visual Studio Team Edition for Database Professionals: Dave Bost, Eric…

Skip to main content