Calculate frame rate better using sliding window.