Script Timer

  • Thread starter Thread starter Aaron
  • Start date Start date
A

Aaron

I need to time the execution time of a script and
output the exe time as a string.

can someone help me write this function in csharp


time1 //at the beginning of the script

..
..
..

time2 //at the end of the script
string exeTime = time2 - time1


thanks
 
Aaron said:
I need to time the execution time of a script and
output the exe time as a string.
can someone help me write this function in csharp

Aaron,
You can use the following:
DateTime dt1 = DateTime.Now;
MakeACall();
DateTime dt2 = DateTime.Now;
TimeSpan ts = dt2 - dt1;
string diff = ts.ToString();

You can also use Microsoft Enterprise Instrumentation framework (EIF)
http://msdn.microsoft.com/vstudio/productinfo/enterprise/eif/

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP

Hire top-notch developers at
http://www.able-consulting.com
 
Back
Top