Pull out fps monitoring code from visualization.