code for measuring frame rate
master merged with fps stuff