-1

I'm trying to work with the performance and diagnostics section of Visual Studio and interestingly found out that the time needed for running code in CPU Sampling is half of code run time.

Why this happens?

Can I use this and instead of running code run CPU Sampling profiler and get results earlier?

J. Steen
  • 15,470
  • 15
  • 56
  • 63
Mehdi
  • 211
  • 2
  • 11

1 Answers1

1

Such effect should not be possible, unless there is another factor which is not clearly seen by you (like running Release against Debug mode etc.)

As MSDN says:

The sampling profiling method collects statistical data about the work that is performed by an application during a profiling run. The sampling method is lightweight and has little effect on the execution of the application methods

(...)

The sampling profiling method interrupts the computer processor at set intervals and collects the function call stack.

Community
  • 1
  • 1
Konrad Kokosa
  • 16,563
  • 2
  • 36
  • 58