Calculate the mouse movement distance

I am wondering if anyone can share with a good example on how to detect the distance of the mouse movement in a certain time. I’d like to be able to calculate the distance the mouse was moved from one point to another in certain time (one second) and compare these values. Please let me know if you have any good sample. Thank you in advance.