public NetCountersValueDistributor(CountersInfoAggregator aggregator, int distributionPeriodMs, PerfCountersStableNetClient netClient)
            : base(aggregator, distributionPeriodMs, "NetCounters (" + netClient.RemoteSideName + ")")
        {
            if (netClient == null)
            {
                throw new ArgumentNullException("netClient");
            }

            _netClient  = netClient;
            _clientData = new ClientData(LocalMachineInfo.MachineName, LocalMachineInfo.MachineAddress, LocalMachineInfo.ProcessName, LocalMachineInfo.ProcessId);
        }
Exemple #2
0
        /// <summary>
        /// Конструктор CounterValueDistributorBase
        /// </summary>
        /// <param name="aggregator">Агрегатор данных счётчиков</param>
        /// <param name="distributionPeriodMs">Период рассылки</param>
        /// <param name="name">Имя</param>
        public CounterValueDistributorBase(CountersInfoAggregator aggregator, int distributionPeriodMs, string name = "generic")
        {
            if (aggregator == null)
            {
                throw new ArgumentNullException("aggregator");
            }
            if (distributionPeriodMs <= 1)
            {
                throw new ArgumentException("distributionPeriodMs <= 1");
            }

            _distributionPeriodMs = distributionPeriodMs;
            _aggregator           = aggregator;

            _isStopRequested    = new CancellationTokenSource();
            _distributionThread = null;
            Name = name;
        }
Exemple #3
0
        /// <summary>
        /// Конструктор NetCounterFactory
        /// </summary>
        /// <param name="distributionPeriodMs">Период рассылки данных счётчиков</param>
        /// <param name="serverAddress">ip-адрес сервера</param>
        /// <param name="serverPort">Порт сервера</param>
        public NetCounterFactory(int distributionPeriodMs, string serverAddress, int serverPort)
        {
            if (distributionPeriodMs <= 1)
            {
                throw new ArgumentException("distributionPeriodMs <= 1");
            }
            if (serverAddress == null)
            {
                throw new ArgumentNullException("serverAddress");
            }
            if (serverPort <= 0 || serverPort > 65535)
            {
                throw new ArgumentException("serverPort <= 0 || serverPort > 65535");
            }

            _internalCategory  = new NetEmptyCategory("", "root", null);
            _valuesAggreagator = new CountersInfoAggregator(_internalCategory);
            _netClient         = PerfCountersStableNetClient.CreateOnTcp(serverAddress, serverPort);
            _valuesDistributor = new NetCountersValueDistributor(_valuesAggreagator, distributionPeriodMs, _netClient);
        }