code for measuring frame rate