Possibly some methods to turn on and turn off profiling from code?
Or can you select a specific function to profile ?
Possibly some methods to turn on and turn off profiling from code?
Or can you select a specific function to profile ?
Don't.
You are looking for "the bottleneck", right?
It's probably not in the function where you think it is.
This is the method I rely on, for any language or OS.
If the problem is in that function, it will tell you. If it is somewhere else, it will tell you.
Yes, with a little effort, you can do this if you do instrumentation profiling (not sampling):
The /include syntax is a little weird, but if you launch a VS command prompt and go to your binary's directory, you can run "vsinstr.exe /dumpfuncs foo.exe" to see the list of methods you can explicitly include.
See the vsinstr.exe command-line syntax for more info.
You can also use the profiler's data collection API to start and stop profiling around the methods you're interested in. See this MSDN article for a walkthrough.
The best way to use the API in this case would be to call StartProfile just before your methods execute and then call StopProfile just after. You should start profiling via the "Start With Profiling Paused" option so you don't start profiling until you hit the first call to StartProfile.
Using the data collection API will work with sampling or instrumentation.