Improved fps counter algorithm