2

I can profile the complete application by clicking "Actions, Start profiling" in performance explorer.

But I wish to profile only a piece of code, so I followed this answer and came up with this code:

StartProfile(PROFILE_PROCESSLEVEL, PROFILE_CURRENTID);
testcode();
StopProfile(PROFILE_PROCESSLEVEL, PROFILE_CURRENTID);

so I use the "Start With Profiling Paused" but the profiler never starts profiling.

I've tried all levels (PROFILE_GLOBALLEVEL, PROFILE_PROCESSLEVEL and PROFILE_THREADLEVEL) - none of them work.

Any ideas?

Community
  • 1
  • 1
aleksazr
  • 89
  • 7
  • Just to rule out the obvious, are you sure execution reaches those lines? – Cameron Nov 20 '14 at 17:57
  • Try adding an extra `StopProfile` before the `StartProfile`. And use `PROFILE_GLOBALLEVEL`. And try attaching the profiler afterwards instead of 'Start with profiling paused'. That worked for me with the .NET API wrapper. – Cameron Nov 24 '14 at 19:47
  • Hmm, darn. I guess that also rules out starting profiling from the IDE, then pausing profiling really fast before it reaches your code? – Cameron Nov 24 '14 at 22:48
  • First two suggestions I have already tried. The third means that I would have to somehow pause my app - which I would rather not do. Anyway, I've switched to [AMD's CodeXL](http://developer.amd.com/tools-and-sdks/opencl-zone/codexl/). It probably can't profile only a piece of code, but is at least faster. – aleksazr Nov 24 '14 at 22:53

0 Answers0