Created On:  20 September 2010

Problem:

CPU Time Charged to Wrong Line in "For" Loop Applies to Performance Analysis and Performance Expert In some cases, CPU time attributable to the expression part of a For loop can be incorrectly attributed to the body of the For loop. This can occur in loops formatted so that the initializers, expression, and iterators appear on a single line, as in the example below.

using System;
public class ForLoopTest
 {
  public static void Main() 
  {
   for (int i=1; i<=5; i )
    Console.WriteLine(i);
  }
 }
If the body of the For loop appears to be consuming excessive CPU time, reformat your code so the initializers, expression, and iterators appear on separate lines, as shown below.

 {
  for (int i=1; i<=5; i )
   Console.WriteLine(i);
 }

Resolution:

'UseDynamicCalibration' registry flag set to 1. By default it is set to 0.

Browse through the registry:

HKEY_CURRENT_USER\Software\Compuware\DevPartner\Analysis\9.0\PerformanceAnalysis\UseDynamicCalibration
= 1

Explanation:

Setting 'UseDynamicCalibration' =1, the DPS overhead caused by instrumentation will not be excluded.  This overhead is what caused the performance tool to give much higher numbers.
Incident #2352216