1import time
2import resource
3
4time_start = time.perf_counter()
5# insert code here ...
6time_elapsed = (time.perf_counter() - time_start)
7memMb=resource.getrusage(resource.RUSAGE_SELF).ru_maxrss/1024.0/1024.0
8print ("%5.1f secs %5.1f MByte" % (time_elapsed,memMb))
9
10# sample output:
11# 2.3 secs 140.8 MByte