<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">from random import random<br>
<br>
try:<br>
import clr<br>
from System import DateTime<br>
<br>
def timeit(func):<br>
start = DateTime.Now<br>
func()<br>
end = DateTime.Now<br>
print func.__name__, 'took %s ms' % (end - start).TotalMilliseconds</blockquote><div><br>Just a small nitpick or whatever, you might want to consider using the System.Diagnostics.StopWatch class as it "Provides a set of methods and properties that you can use to accurately measure elapsed time."<br>
<br>i.e.<br><br>try:<br> import clr<br> from System.Diagnostics import StopWatch<br><br> def timeit(func):<br> watch = StopWatch()<br> watch.Start()<br> func()<br> watch.Stop()<br> print func.__name__, 'took %s ms' % watch.Elapsed.TotalMilliseconds<br>
<br></div><div></div></div>