if you want to count the delay of your function in c#, you can use this code:
1 double firstTime = Environment.TickCount & Int32.MaxValue;
2 // function you want to count the time (delay)
3 int lastTime = Environment.TickCount & Int32.MaxValue; //the result in milisecond
4 double delay = (lastTime – lastTime) / 1000; // delay in second