how can you measure how much time has passed since the start of an instruction?

e.g.: how long (in miliseconds) does it take to perform the following code:


for i=0 to 10000
total=total+1
next