Measuring timing process of DMA operation

Hi, I am trying to use %%timeit to measure a DMA data transfer time but I get an error, is there another way to measure the processing time needed?

%%timeit

def run_kernel():

dma.sendchannel.transfer(in_buffer)
dma.recvchannel.transfer(out_buffer)    
hog_accel.write(0x00,0x81) # start
dma.sendchannel.wait()
dma.recvchannel.wait()

run_kernel()

Python has a time and a datetime class, either of which can be used to measure duration. Grab the time at the start and end of the process and print the difference.

import time
start = time.time()
end = time.time()
print(end-start)
4.096667528152466

Here you can see how slowly I type (in seconds).

1 Like

Great thanks @Colorado_Rob