Beispiel #1
0
	def run(self, meth, *args, **kwargs):
		res = FunctionTimerResult(_form_name(meth, args, kwargs))
		start = clock()
		for i in xrange(self._iter):
			rv = apply(meth, args, kwargs)
		end = clock()
		res.runtime = ((end - start)/self._iter) - self._overhead
		res.overhead = self._overhead
		res.returnvalue = rv
		return res
Beispiel #2
0
def time_it(count, callit, *args, **kwargs):
	start = clock()
	for i in range(count):
		apply(callit, args, kwargs)
	end = clock()
	return (end - start)/count