This project calculates the mouse speed. with a small, single script. Maybe you can use it in yopur own projects?