Measuring time of only a part of a for-loop

You could get your second example to work with:

const to = TimerOutput()
disable_timer!(to)
	for i in 1:100
		if i == 2
			enable_timer!(to)
		elseif i == 88
			disable_timer!(to)
		end
		@timeit to "part_of_loop" begin
                #instructions
        end
	end
end