Precision timing using DateTime possible?
I would like to test the time required by certain methods and SQL queries
in my code. I've tried doing the following:
DateTime start = DateTime.Now;
//Do something
DateTime end = DateTime.Now;
TimeSpan ts = end - start;
int millis = ts.Milliseconds;
But I just don't feel that this is the right way of doing it. I often get
back a value of 1 for some methods and values like 200 for others, are
there any accurate ways to measure and record this kind of thing?
No comments:
Post a Comment