Ejemplo n.º 1
0
        public bool TryUpdate()
        {
            if ((DateTime.Now - _lastUpdatedAt).TotalSeconds >= 1)
            {
                foreach (var channel in _provider.GetAllChannels())
                {
                    if (!_historyByChannel.TryGetValue(channel, out var history))
                    {
                        _historyByChannel[channel] = history = new DataRatePoints();
                    }

                    var diagInfo = ((IGrpcChannelxDiagnosticsInfo)channel);
                    history.AddValues(diagInfo.Stats.ReceiveBytesPerSecond, diagInfo.Stats.SentBytesPerSecond);
                }

                _lastUpdatedAt = DateTime.Now;
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
 public IReadOnlyCollection <GrpcChannelx> GetAllChannels()
 {
     return(_baseProvider.GetAllChannels());
 }