I am trying to check how long a function takes to execute in my code:
I have done this:
void foo()
{
int time = System.DateTime.Now.Millisecond;
// code of my function. do this, that, etc.
Console.WriteLine((System.DateTime.Now.Millisecond-time).ToString());
}
What I understand:
-247
I do not understand why the minus ?? & Amp; please tell me how to measure the time spent by the function. & Amp; If pro-filer is an option, then please recommend me some simple options.
Note. Here I showed a console application, but in practice I need for a web application in ASP.NET, which can also be an n-tier architecture.
thank
source
share