I am trying to understand how long it takes for a function to run using time.timer, but im really stumped on how to implement it I thought this would work:
def breadth_first_tree_search(problem):
"Search the shallowest nodes in the search tree first."
t1 = timeit.Timer(lambda: problem)
n = 1
secs = t1.timeit(number = n)
print ("\n%d times took %8f seconds" % (n,secs))
return tree_search(problem, FIFOQueue())
but then I realized its timing the wrong thing.
I need it to check the runtime of breadth_first_tree_search
can some one tell me how to do thi I keep getting the feeling that it isnt that hard but I cant figure out how.