Beispiel #1
0
        public LatencyMonitor(
            IRpcProtocol protocol, IPhotonPeer nativePeer, byte operationCode, int maxHistoryLength, int intervalMs, WorkloadController workloadController)
            : base(protocol, nativePeer)
        {
            this.operationCode      = operationCode;
            this.intervalMs         = intervalMs;
            this.workloadController = workloadController;
            this.latencyHistory     = new ValueHistory(maxHistoryLength);
            this.averageLatencyMs   = 0;
            this.lastLatencyMs      = 0;

            log.InfoFormat("{1} connection for latency monitoring established (id={0}), serverId={2}", this.ConnectionId, this.NetworkProtocol, GameApplication.ServerId);

            if (!Stopwatch.IsHighResolution)
            {
                log.InfoFormat("No hires stopwatch!");
            }

            this.pingTimer = this.RequestFiber.ScheduleOnInterval(this.Ping, 0, this.intervalMs);
        }
 public AverageCounterReader(int capacity, string categoryName, string counterName, string instanceName)
     : base(categoryName, counterName, instanceName)
 {
     this.values = new ValueHistory(capacity);
 }