code: def get_refresh_stats(self):
          
          if self.rf_draw_count == 0:
              fps = 0.0
          else:
              interval = time.time() - self.rf_start_time
              fps = self.rf_draw_count / interval
  
          jitter = self.rf_delta_total / max(1, self.rf_timer_count)
  
          late_avg = self.rf_late_total / max(1, self.rf_late_count)
          late_pct = self.rf_late_count / max(1.0, float(self.rf_timer_count)) * 100
  
          early_avg = self.rf_early_total / max(1, self.rf_early_count)
          early_pct = self.rf_early_count / max(1.0, float(self.rf_timer_count)) * 100
  
          balance = self.rf_late_total - self.rf_early_total
  
          stats = dict(fps=fps, jitter=jitter,
                       early_avg=early_avg, early_pct=early_pct,
                       late_avg=late_avg, late_pct=late_pct,
                       balance=balance)
          return stats
docs: Return the measured statistics for timed refresh intervals.
  
          Returns
          -------
          stats : float
              The measured rate of actual back end updates in frames per second.