Hello everyone,
I am working on arcmap 10.3.1 and python 2.7.8. I need to determine how much time arcpy needed to finish a specific task (add layer) . I'm using this code:
import arcpy,os,sys,string,datetime,timeit
import arcpy.mapping
from arcpy import env
env.workspace = r"C:\Project"
Layer1 = arcpy.mapping.Layer(r"C:\Project\layers\atikot.lyr")
counter = 0
for mxd in arcpy.ListFiles("*.mxd"):
print (mxd)
mapdoc = arcpy.mapping.MapDocument(r"C:\Project\\" + mxd)
df = arcpy.mapping.ListDataFrames(mapdoc, "Layers")[0]
arcpy.mapping.AddLayer(df ,Layer1, "TOP")
print ('AddLayer')
mapdoc.save()
counter = counter + 1
del mxd
print (counter)
print str(datetime.datetime.now().date())
print time.clock()When i run it i get:
>>>
Project 2.mxd
AddLayer
Project.mxd
AddLayer
soil.mxd
AddLayer
soil_20008.mxd
AddLayer
ta34b_4.mxd
AddLayer
wells.mxd
AddLayer
6
2015-03-18
3.20723655198e-07
>>>
I have been unable to get execution times for the processes. when i measured this process with stopper -i got 9.6 second in real time
but in the code the score is 3.207. I dont know if 3.2 is seconds -and if it is that mean this time isn't right.
Any help would be great