def time_func(&block)
start_time = Time.now
yield
end_time = Time.now
return end_time - start_time
end
Usage is straightforward:
time_func do my_test_function(args...) end
Various notes taken along my developer journey
def time_func(&block)
start_time = Time.now
yield
end_time = Time.now
return end_time - start_time
end
time_func do my_test_function(args...) end
No comments:
Post a Comment