Update the FPS whenever a heartbeat message is received from the app.
510315
function(message) {
        if (!this._tickList) {
            this._tickList = [];
            while (this._tickList.length < this._maxTicks) {
                this._tickList.push(0);
            }
        }

        if (!this._lastHeart) {
            this._lastHeart = Date.now();
            this._lastFpsUpdate = this._lastHeart;
            return;
        }

        var newHeart = Date.now();
        var newTick = newHeart - this._lastHeart;
        this._lastHeart = newHeart;

        this._tickSum -= this._tickList[this._tickIndex];
        this._tickSum += newTick;
        this._tickList[this._tickIndex] = newTick;
        if (++this._tickIndex == this._maxTicks) {
            this._tickIndex = 0;
        }
    }
1307794
function(time) {
    var ms = time - this.lastTime;
    this.lastTime = time;

    // Update the different components of the scene.
    this.map.update(ms / 1000);
    this.player.update(ms / 1000);
    this.camera.render(this.player, this.map);

    // Continue the game loop.
    requestAnimationFrame(this.tick.bind(this));
  }
564435
function FrameRateBase(fps) {
	var F = this
	F.pool = []
	F.fps = fps

	F._frameTime = Math.floor(1000 / F.fps)
	F._prevTime = 0
	F._startTime = 0
	F._nextTime = 0
	F._maxLag = 400
	F._shiftLag = 30
	F._paused = false
	F._prevCallTime = Date.now()

	F.diffTime = 0
}
924202
def start_heartbeat(self):
        """"""
        self.stop_heartbeat()

        self._heartbeat_timer = periodic.Callback(self._heartbeat,
                                                  self._heartbeat_interval,
                                                  self.server.io_loop)
        self._heartbeat_timer.start()
5357
private void runHeartbeatLoop() {
		final long interval = GlobalConfiguration.getInteger(
						ConfigConstants.TASK_MANAGER_HEARTBEAT_INTERVAL_KEY,
						ConfigConstants.DEFAULT_TASK_MANAGER_HEARTBEAT_INTERVAL);

		while (!shutdownStarted.get()) {
			// send heart beat
			try {
				LOG.debug("heartbeat");
				this.jobManager.sendHeartbeat(this.localInstanceConnectionInfo, this.hardwareDescription);
			} catch (IOException e) {
				if (shutdownStarted.get()) {
					break;
				} else {
					LOG.error("Sending the heart beat caused an exception: " + e.getMessage(), e);
				}
			}
			
			// sleep until the next heart beat
			try {
				Thread.sleep(interval);
			}
			catch (InterruptedException e) {
				if (!shutdownStarted.get()) {
					LOG.error("TaskManager heart beat loop was interrupted without shutdown.");
				}
			}
		}
	}
1265237
def ping(self):
        
        from datetime import datetime
        nextRun = datetime.utcnow().timestamp() + self.cfg.getPingInterval()
        self.sendHeartbeat()
        self.scheduleNextHeartbeat(nextRun)
1322329
public function onHeartbeat()
    {
        $now = microtime(true);
        $nextHeartbeat = ($this->lastWrite ?: $now) + $this->options["heartbeat"];

        if ($now >= $nextHeartbeat) {
            $this->writer->appendFrame(new HeartbeatFrame(), $this->writeBuffer);
            $this->flushWriteBuffer()->done(function () {
                $this->heartbeatTimer = $this->eventLoop->addTimer($this->options["heartbeat"], [$this, "onHeartbeat"]);
            });

        } else {
            $this->heartbeatTimer = $this->eventLoop->addTimer($nextHeartbeat - $now, [$this, "onHeartbeat"]);
        }
    }
787391
synchronized void statusUpdate(State runState, 
                                 float progress,
                                 String state, 
                                 Phase phase,
                                 long finishTime) {
    setRunState(runState);
    setProgress(progress);
    setStateString(state);
    setPhase(phase);
    if (finishTime > 0) {
      setFinishTime(finishTime); 
    }
  }
396024
function() {
    var self = this
    self._shouldSyncFromOpts = true
    self.on('update', function() {
      if (self._shouldSyncFromOpts) self.trigger('sync')
      self._shouldSyncFromOpts = true
    })
  }
682944
function heartbeat() {
      Instance.db.updateOne(
        {
          _id: instanceId
        },
        {
          $set: { lastAliveOn: new Date() }
        },
        {
          upsert: true
        }
      );
    }
1133605
function setupFPS() {
  stats.showPanel(0);  // 0: fps, 1: ms, 2: mb, 3+: custom
  if (guiState.showFps) {
    document.body.appendChild(stats.dom);
  }
}
26439
async def ping(self, message: bytes=b'') -> None:
        """"""
        if isinstance(message, str):
            message = message.encode('utf-8')
        await self._send_frame(message, WSMsgType.PING)
1174768
def set_heartbeat(self, state):
        

        if state in ["on", "off", "open"]:
            self.heartbeat = state
            self.server.request("screen_set %s heartbeat %s" % (self.ref, self.heartbeat))
252064
public void setFPSLimit(double fps) {
		if (fps > MAX_FREQUENCY) {
			fps = MAX_FREQUENCY;
		}
		if (fps < MIN_FREQUENCY) {
			fps = MIN_FREQUENCY;
		}
		this.frequency = fps;
	}
1113789
public void acknowledgeHeartBeat( Instance scopedInstance ) {

		String count = scopedInstance.data.get( MISSED_HEARTBEATS );
		if( count != null
				&& Integer.parseInt( count ) > THRESHOLD )
			this.logger.info( "Agent " + InstanceHelpers.computeInstancePath( scopedInstance ) + " is alive and reachable again." );

		// Store the moment the first ACK (without interruption) was received.
		// If we were deploying, store it.
		// If we were in problem, store it.
		// If we were already deployed and started, do NOT override it.
		if( scopedInstance.getStatus() != InstanceStatus.DEPLOYED_STARTED
				|| ! scopedInstance.data.containsKey( Instance.RUNNING_FROM ))
			scopedInstance.data.put( Instance.RUNNING_FROM, String.valueOf( new Date().getTime()));

		scopedInstance.setStatus( InstanceStatus.DEPLOYED_STARTED );
		scopedInstance.data.remove( MISSED_HEARTBEATS );
	}
169300
def update(self, screen, clock):
        """"""

        # If a music file was passed, start playing it on repeat
        if self.music is not None:
            pygame.mixer.music.play(-1)

        while True:
            clock.tick(30)
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    pygame.quit()
                    sys.exit()
                # Check if any of the buttons were clicked
                for i in self.buttonlist:
                    if (event.type == pygame.MOUSEBUTTONUP and
                            i.rect.collidepoint(pygame.mouse.get_pos())):
                        if self.music is not None:
                            pygame.mixer.music.stop()
                        if self.widgetlist:
                            return [i(), self.widget_status()]
                        else:
                            return i()
                # If there is a widget list, check to see if any were clicked
                if self.widgetlist:
                    for i in self.widgetlist:
                        if (event.type == pygame.MOUSEBUTTONDOWN and
                                i.rect.collidepoint(pygame.mouse.get_pos())):
                            # Call the widget and give it the menu information
                            i(self)
            screen.blit(self.image, self.pos)
            pygame.display.flip()
1358237
def _heartbeat_loop(self):
        """"""
        self.logger.debug("running main heartbeat thread")
        while not self.closed:
            time.sleep(self.settings['SLEEP_TIME'])
            self._report_self()