Options

Strange results when profiling .NET application

slaneyrwslaneyrw Posts: 46
I have just profiled an application but I am seeing very strange HitCounts/Timing when viewing the results.
[STAThread]
static void Main(string[] args)
{
	try
	{
		SwitchBinder.SetSwitchBoundStatic(typeof(Arguments),args);
		Controller c = new Controller();
		bool initOK = c.Init();

		if (!initOK)
			return;

		c.Run();
	}
	...
}

With the above block, the hit counts and time reported were :

Line 31 (SwitchBinder) HitCount = 1, Time = 0.136
Line 32 (Controller c) HitCount = 1, Time = 0.0000
Line 33 (bool initOK) HitCount = 1, Time = 0.278
Line 35 (if (!initOK) ) HitCount = 1, Time = 0.0000
Line 38 (c.Run()) HitCount = 2, Time = 56.7

It is NOT possible to execute line 38 twice

Also, the total time fo this method with Children (as reported) was 77.0579 seconds.

There were 2 more lines of code (finally block) that combined reported 0.806 seconds. That does not add up to 77 seconds, there is approx 20 seconds unaccounted for.


Further, if I drill down into the c.Run method
public void Run()
{
	ITaskRun task = CreateJobMailTask();
	task.Run();
}

The 2 lines here reported 0.0231 and 38.3 seconds respectively in the source code window, but in the Hierarchy window, the two methods report
0.0231 and 18.3112. Again another discrepancy of about 20 seconds.

If I again drill down in the Task.Run method, the Hierachy window report 18.3112 seconds, but the list of child methods call report a total of 29.4298 seconds, all of which are ONLY called from this method.

One method reported in this child list is reported to called once with 9.4258 seconds, but in the source window the corresponding line has a hit count of 0 and time of 0.0000.

Comments

  • Options
    Hello,

    I have forwarded your enquiry to another technician who will be in contact with you via email. Due to the complicated nature of instrumenting code, it would be better if you dealt with him directly to try to determine the cause of any timing irregularities.
This discussion has been closed.