What is the easiest way to run some code each millisecond for a certain amount of time?

Which is it ?