Function Call Count

I would like to count the number of times the following methods have been executed since the application started. How can i do this?

System.Drawing.Graphics.FromHdcInternal(IntPtr hdc)
System.Drawing.BufferedGraphicsContext.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height)
+3
source share
3 answers

The canonical, easiest way is probably to just use a profiler application. Personally, I have a good impression of jetBrains dotTrace , but there are more.

Basically, what you do is letting the profiler run your application, and it will keep track of all the method calls in your code. Then it will show you how much time has been spent executing these methods, and how many times they are called.

, , , , . , , , , . , , ; -)

+1

. - , .

, . .

private int invokeCount = 0;

public static Graphics FromHdcInternalWrapped(IntPtr hdc)
{
     invokeCount++;
     return Graphics.FromHdcInternal(hdc);
}

.

+2

AQtime does this without difficulty.

+2
source

All Articles