Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
HI all,

Anyone know how to get Time Spent in a Method duing RUN TIME. hope this question must be funny. but i came up with this idea to implement in my project. so that i can monitor where exactly more time has been spent. does any one have any idea?
Posted

To add to what CPallini suggests, there is also the .NET Stopwatch class[^] whihc will let you measure it as well.
 
Share this answer
 
Comments
[no name] 19-May-14 22:50pm    
Thanks a lot hope i will continue from here and let you know if i have questions on that.
A profiler[^] knows.
Also, Google[^] helps.
 
Share this answer
 
Hello,

If you want to do something really cool, you could use CLR injection.

There's a very interesting article about it on CP:
CLR Injection: Runtime Method Replacer[^]

And also a more in depth explanation can be found here:
http://www.ntcore.com/Files/netint_injection.htm[^]

Valery.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900