class Timer:
def __enter__(self):
self.start = time.clock()
return self
def __exit__(self, *args):
self.end = time.clock()
self.interval = self.end - self.start
import arcpy
t = Timer()
with t:
#list the things in the workspace
ws_output = r'in_memory'
for fc in arcpy.ListFeatureClasses():
print fc
itemsecs = "Total processing seconds: %.02f secs." % (t.interval)
print itemsecs