Sure, the general pattern is like
torch.cuda.synchronize() # clear out everything that might have been going on before
t1 = time.time()
for i in range(iterations):
    do_stuff_on_gpu()
torch.cuda.synchronize() #make sure everything finished
t2 = time.time()
diff = t2 - t1