Is there anyway to measure the time it takes for a block of code to be executed?

Just want to measure if my optimisations are really optimising.