Ejemplo n.º 1
0
        protected virtual async Task JoinLeaveGroup(int localIndex, IDictionary <string, object> data)
        {
            // Extract data
            data.TryGetTypedValue(SignalRConstants.GroupName, out string groupName, Convert.ToString);
            data.TryGetTypedValue(_isIngroup, out bool isInGroup, Convert.ToBoolean);

            // Join or leave groups
            if (isInGroup)
            {
                try
                {
                    await Connections[localIndex].SendAsync(SignalRConstants.LeaveGroupCallbackName, groupName);
                }
                catch
                {
                    StatisticsCollector.IncreaseLeaveGroupFail();
                }
            }
            else
            {
                try
                {
                    await Connections[localIndex].SendAsync(SignalRConstants.JoinGroupCallbackName, groupName);
                }
                catch
                {
                    StatisticsCollector.IncreaseJoinGroupFail();
                }
            }

            data[_isIngroup] = !isInGroup;
        }
Ejemplo n.º 2
0
        public ArrayHelper <T> GetArrayHelper(StatisticsCollector statisticsCollector)
        {
            var arrayHelper = new ArrayHelper <T>();

            arrayHelper.OnOperationExecute += statisticsCollector.CollectStatistics;
            return(arrayHelper);
        }
Ejemplo n.º 3
0
 protected UpgradedCache(IStatChannel channel, StatisticsCollector collector, bool cleanRareItems = true, IComparer <T> comparer = null, IEqualityComparer <T> eqcomparer = null, Action <Action> queueRebalance = null)
     : this(cleanRareItems, comparer, eqcomparer, queueRebalance)
 {
     _channel   = channel;
     _collector = collector;
     _secondLevelCache.Channel = _channel;
 }
Ejemplo n.º 4
0
        internal static void InitSchedulerLogging()
        {
            TraceLogger.UnInitialize();
            //TraceLogger.LogConsumers.Add(new LogWriterToConsole());
            if (!Logger.TelemetryConsumers.OfType <ConsoleTelemetryConsumer>().Any())
            {
                Logger.TelemetryConsumers.Add(new ConsoleTelemetryConsumer());
            }

            var traceLevels = new[]
            {
                Tuple.Create("Scheduler", Severity.Verbose3),
                Tuple.Create("Scheduler.WorkerPoolThread", Severity.Verbose2),
            };

            TraceLogger.SetTraceLevelOverrides(new List <Tuple <string, Severity> >(traceLevels));

            var orleansConfig = new ClusterConfiguration();

            orleansConfig.StandardLoad();
            NodeConfiguration config = orleansConfig.GetOrAddConfigurationForNode("Primary");

            StatisticsCollector.Initialize(config);
            SchedulerStatisticsGroup.Init();
        }
Ejemplo n.º 5
0
        public void ShouldCloseIdleForTooLongConns(int sessionCount)
        {
            // Given
            var statisticsCollector = new StatisticsCollector();

            using (var driver = GraphDatabase.Driver("bolt://127.0.0.1:7687", AuthToken, new Config
            {
                DriverStatisticsCollector = statisticsCollector,
                ConnectionIdleTimeout = TimeSpan.Zero // enable but always timeout idle connections
            }))
            {
                // When
                for (var i = 0; i < sessionCount; i++)
                {
                    // should not reuse the same connection as it should timeout
                    using (var session = driver.Session())
                    {
                        var ret = session.Run("RETURN 1").Single();
                        ret[0].ValueAs <int>().Should().Be(1);
                        Thread.Sleep(1); // block to let the timer aware the timeout
                    }
                }

                // Then
                var st = ConnectionPoolStatistics.Read(statisticsCollector.CollectStatistics());
                Output.WriteLine(st.ReportStatistics().ToContentString());
                st.ConnCreated.Should().Be(sessionCount);
                st.ConnCreated.Should().Be(st.ConnClosed + 1);
            }
        }
Ejemplo n.º 6
0
 public void addOrder(StatisticsCollector collector, Position position, Trade trade)
 {
     if (trade.order().system() != this)
     {
         return;
     }
     collector.addOrder(new WeightedPosition(position), new WeightedTrade(trade));
 }
Ejemplo n.º 7
0
 public void addOrder(StatisticsCollector collector, Position position, Trade trade)
 {
     if (!collects(position))
     {
         return;
     }
     collector.addOrder(new WeightedPosition(position), new WeightedTrade(trade));
 }
Ejemplo n.º 8
0
 public void addBar(StatisticsCollector collector, System system, Dictionary <Symbol, Bar> bars, Dictionary <Symbol, double> fxRates)
 {
     if (!bars.ContainsKey(this))
     {
         return;
     }
     collector.addBar(convert(system.positions(this), p => new WeightedPosition(p)), dictionaryOne(this, bars[this]), fxRates);
 }
Ejemplo n.º 9
0
        public UserNotificationStore(IUserNotificationRepository repository, ICounterService counters, IClock clock)
        {
            this.repository = repository;
            this.counters   = counters;
            this.clock      = clock;

            collector = new StatisticsCollector(repository, 5000);
        }
Ejemplo n.º 10
0
 protected void UpdateStatistics(
     StatisticsCollector statisticsCollector,
     int sendingStep)
 {
     SignalRUtils.ResetCounters(statisticsCollector);
     UpdateEpoch(statisticsCollector);
     SetSendingStep(statisticsCollector, sendingStep);
 }
Ejemplo n.º 11
0
 public FloodingNetworkLayer(string localAddress, SimulationConfiguration configuration, Logger logger, LinkLayer link, StatisticsCollector results)
 {
     _localAddress = localAddress;
     _conf         = configuration;
     _logger       = logger;
     _linkLayer    = link;
     _statistics   = results;
     _time         = TimeHelper.GetInstance();
 }
Ejemplo n.º 12
0
 public void Clear()
 {
     if (_size > 0)
     {
         Array.Clear(_items, 0, _size);
         StatisticsCollector.ChangeStatistics(_size);
         _size = 0;
     }
 }
Ejemplo n.º 13
0
        private ICachierStorage <Guid> GetStorageForCacheData(StatisticsCollector statisticsCollector, bool keepAllItems)
        {
            var storage = new CurrentCachierStorageRef(_getter.StatChannel, statisticsCollector,
                                                       new CachierStorageSettings {
                KeepAllItems = keepAllItems
            });

            return(storage);
        }
Ejemplo n.º 14
0
        public LinkLayer(SimulationConfiguration conf, List <List <Satellite> > constellation, Satellite thisSatellite, Logger logger, StatisticsCollector results)
        {
            _conf          = conf;
            _constellation = constellation;
            _thisSatellite = thisSatellite;
            _logger        = logger;
            _statistics    = results;

            _lastNeighbours = new Dictionary <string, Satellite>();
        }
Ejemplo n.º 15
0
        public override void addBar(StatisticsCollector collector, System system, Dictionary <Symbol, Bar> theBars, Dictionary <Symbol, double> fxRates)
        {
            if (!theBars.ContainsKey(symbol))
            {
                return;
            }
            var weighted = convert(positions(), p => new WeightedPosition(p));

            collector.addBar(weighted, dictionaryOne(symbol, theBars[symbol]), fxRates);
        }
Ejemplo n.º 16
0
        public IStreamState Create(string name)
        {
            var statistics     = new StatisticsCollector();
            var sendSignal     = new AsyncManualResetEvent(false);
            var bufferPool     = CreateBufferPool();
            var recordWriter   = CreateRecordWriter(name, statistics, sendSignal);
            var memoryAnalyzer = new MemoryAnalyzer(globalMemoryManager, settings.GcSettings);

            return(new StreamState(name, bufferPool, memoryAnalyzer, recordWriter, statistics, sendSignal));
        }
 public AodvNetworkLayer(string localAddress, SimulationConfiguration configuration, Logger logger, LinkLayer link, StatisticsCollector results)
 {
     _aodvHelper     = new AodvHelper(localAddress, configuration, logger);
     _localAddress   = localAddress;
     _logger         = logger;
     _time           = TimeHelper.GetInstance();
     _linkLayer      = link;
     _statistics     = results;
     _conf           = configuration;
     _aodvParameters = _conf.AodvConfiguration;
 }
Ejemplo n.º 18
0
 public static void AddOnConnectedCallback(
     IList <IHubConnectionAdapter> connections,
     IList <Action <IList <IHubConnectionAdapter>, StatisticsCollector> > registeredCallbacks,
     StatisticsCollector statisticsCollector)
 {
     if (!registeredCallbacks.Contains(RegisterCallbackBase.SetDummyCallbackOnConnected))
     {
         RegisterCallbackBase.SetCallbackOnConnected(connections, statisticsCollector);
         registeredCallbacks.Add(RegisterCallbackBase.SetDummyCallbackOnConnected);
     }
 }
Ejemplo n.º 19
0
 public static void SetCallbackLeaveGroup(
     IList <IHubConnectionAdapter> connections,
     StatisticsCollector statisticsCollector)
 {
     foreach (var connection in connections)
     {
         connection.On(SignalRConstants.LeaveGroupCallbackName, () =>
         {
             statisticsCollector.IncreaseLeaveGroupSuccess();
         });
     }
 }
Ejemplo n.º 20
0
        public CommandExecuter()
        {
            _appIdsPath =
                Path.Combine(
                    Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                    "Applications.xml");
            _appConfig = new AppConfig();
            ParseAppIds();

            _statisticsCollector = new StatisticsCollector();
            _statisticsCollector.Start();
        }
Ejemplo n.º 21
0
        void addCurve(StatisticsCollector collector, int divisor, string name, Color color, bool useDates)
        {
            var equity = Objects.array(Objects.convert(Objects.cumulativeSum(collector.pnl()), p => p / divisor));
            var dates  = Objects.array(Objects.convert(collector.dates(), d => useDates ? new XDate(d).XLDate : dateParent.index(d)));
            var line   = AddCurve(name, dates, equity, color, SymbolType.None);

            graphables.Add(new EquityGraphable(name, equity, collector.dates()));
            if (!useDates)
            {
                line.IsOverrideOrdinal = true;
            }
        }
Ejemplo n.º 22
0
 public static void SetCallbackOnConnected(
     IList <IHubConnectionAdapter> connections,
     StatisticsCollector statisticsCollector)
 {
     foreach (var connection in connections)
     {
         connection.On(SignalRConstants.OnConnectedCallback, (string connectionId) =>
         {
             connection.UpdateTimestampWhenConnected();
         });
     }
 }
Ejemplo n.º 23
0
 public static void SetDummyCallbackOnConnected(
     IList <IHubConnectionAdapter> connections,
     StatisticsCollector statisticsCollector)
 {
     foreach (var connection in connections)
     {
         connection.On(SignalRConstants.OnConnectedCallback, (string connectionId) =>
         {
             Log.Information($"Connection Id: {connectionId}");
         });
     }
 }
Ejemplo n.º 24
0
 public static void SetCallbackJoinGroup(
     IList <IHubConnectionAdapter> connections,
     StatisticsCollector statisticsCollector,
     string methodName = null)
 {
     foreach (var connection in connections)
     {
         connection.On(SignalRConstants.JoinGroupCallbackName, () =>
         {
             statisticsCollector.IncreaseJoinGroupSuccess();
         });
     }
 }
Ejemplo n.º 25
0
 public static void SetCallback(
     IList <IHubConnectionAdapter> connections,
     StatisticsCollector statisticsCollector)
 {
     foreach (var connection in connections)
     {
         connection.On(SignalRConstants.RecordLatencyCallbackName, (IDictionary <string, object> data) =>
         {
             var receiveTimestamp = Util.Timestamp();
             data.TryGetTypedValue(SignalRConstants.Timestamp, out long sendTimestamp, Convert.ToInt64);
             var latency = receiveTimestamp - sendTimestamp;
             statisticsCollector.RecordLatency(latency);
             SignalRUtils.RecordRecvSize(data, statisticsCollector);
         });
Ejemplo n.º 26
0
        public Satellite(string localAddress, Coordinate coordinate, SatPosition satPosition, SatPosition logical, ref List <List <Satellite> > constellation, ref SimulationConfiguration conf, StatisticsCollector results)
        {
            LocalAddress    = localAddress;
            Location        = coordinate;
            SatPosition     = satPosition;
            _conf           = conf;
            LogicalPosition = logical;
            _statistics     = results;

            _logger = new Logger(_conf.OutputPath + "/" + LocalAddress + ".log", conf);
            _logger.WriteLine(LocalAddress + " starting up...");

            _network = new Network.Network(ref constellation, ref conf, this, _logger, _statistics);
        }
Ejemplo n.º 27
0
//        [InlineData(50000)] leave this to a long dedicated build
        public void SoakRun(int threadCount)
        {
            var statisticsCollector = new StatisticsCollector();
            var driver = GraphDatabase.Driver(ServerEndPoint, AuthToken, new Config
            {
                DriverStatisticsCollector = statisticsCollector,
                ConnectionTimeout         = Config.Infinite,
                EncryptionLevel           = EncryptionLevel.Encrypted
            });

            Output.WriteLine($"[{DateTime.Now.ToString("HH:mm:ss.ffffff")}] Started");

            Parallel.For(0, threadCount, i =>
            {
                if (i % 1000 == 0)
                {
                    Output.WriteLine(statisticsCollector.CollectStatistics().ToContentString());
                }

                string[] queries =
                {
                    "RETURN 1295 + 42",
                    "UNWIND range(1,10000) AS x CREATE (n {prop:x}) DELETE n RETURN sum(x)"
                };
                try
                {
                    using (var session = driver.Session())
                    {
                        session.Run(queries[i % 2]).Consume();
                    }
                }
                catch (Exception e)
                {
                    Output.WriteLine(
                        $"[{DateTime.Now.ToString("HH:mm:ss.ffffff")}] Thread {i} failed to run query {queries[i % 2]} due to {e.Message}");
                }
            });

            var st = ConnectionPoolStatistics.Read(statisticsCollector.CollectStatistics());

            Output.WriteLine(st.ReportStatistics().ToContentString());
            Output.WriteLine($"[{DateTime.Now.ToString("HH:mm:ss.ffffff")}] Finished");

            st.ConnToCreate.Should().Be(st.ConnCreated + st.ConnFailedToCreate);
            st.ConnToCreate.Should().Be(st.InUseConns + st.AvailableConns + st.ConnToClose);
            st.ConnClosed.Should().Be(st.ConnClosed);
            st.ConnToCreate.Should().Be(st.ConnCreated);

            driver.Dispose();
        }
Ejemplo n.º 28
0
 public static async Task LeaveFromGroup(
     IHubConnectionAdapter connection,
     string groupName,
     StatisticsCollector statisticsCollector)
 {
     try
     {
         await connection.SendAsync(SignalRConstants.LeaveGroupCallbackName, groupName);
     }
     catch
     {
         statisticsCollector.IncreaseLeaveGroupFail();
     }
 }
Ejemplo n.º 29
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
         deathCount = 0;
         jumpCount  = 0;
         dashCount  = 0;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 30
0
        public void SetUp()
        {
            var conf = new SimulationConfiguration();

            conf.Initialize();
            conf.EnableSatelliteLogging = false;

            var results = new StatisticsCollector();

            results.NewSimulation();

            var logger = new Logger(string.Empty, conf);

            _uut = new AodvHelper(LocalAddr, conf, logger);
        }
Ejemplo n.º 31
0
 public FindKeySuccessorArg(long id, bool returnSuccessorAsResult)
 {
     Id = id;
     ReturnSuccessorAsResult = returnSuccessorAsResult;
     StatsCollector = new StatisticsCollector();
 }
Ejemplo n.º 32
0
 public void StoreStatistics(string type, StatisticsCollector item)
 {
     item.EndStat();
     if (!StatisticsStorage.ContainsKey(type)) {
         StatisticsStorage[type] = new Dictionary<string, StatisticsCollector>();
     }
     StatisticsStorage[type].Add(item.Id, item);
     Log.Write(LogEvent.Debug, "Stored statistics for {0}, details: {1}", item, item.Description);
 }
Ejemplo n.º 33
0
 public GetOverlayNodeByKeyArg(long key)
 {
     StatsCollector = new StatisticsCollector();
     Key = key;
 }
Ejemplo n.º 34
0
 public FindKeySuccessorResult(IOverlayNode result, bool returnSuccessorAsResult)
 {
     Node = result;
     ReturnSuccessorAsResult = returnSuccessorAsResult;
     StatsCollector = new StatisticsCollector();
 }
Ejemplo n.º 35
0
 public QueryNode()
 {
     StatsCollector = new StatisticsCollector();
 }
Ejemplo n.º 36
0
 public Query()
 {
     ResponsibleNodesAssigned = false;
     StatsCollector = new StatisticsCollector();
 }