Пример #1
0
        // ReSharper disable once UnusedMember.Local
        protected override void OnAwake()
        {
            if (!ShouldActivate)
            {
                gameObject.SetActive(false);
                return;
            }

            _nextTick = Stopwatch.GetTimestamp();

            _gateKeepers.Add(_checkForMessages  = PerformanceSampler.CreateGatekeeper(this, "CheckForMessages"));
            _gateKeepers.Add(_onUpdate          = PerformanceSampler.CreateGatekeeper(this, "CheckForMessages"));
            _gateKeepers.Add(_flushSentMessages = PerformanceSampler.CreateGatekeeper(this, "CheckForMessages"));

            if (DisableNetworking)
            {
                return;
            }

            Net = CreateInstance();
            Net.PopulateMessageTable(Assembly.GetExecutingAssembly());
            Net.LogMessage += LogHandler(LogPrefix);

            Net.RegisterHandler <INetworkableMessage>(OnReceiveMessage);

            OnNetworkingAwake();
        }
Пример #2
0
        public ActionResult Sample()
        {
            var samples = PerformanceSampler.ListInstances().Select(i =>
                                                                    new
            {
                name         = i,
                duration     = PerformanceSampler.ForInstance(i).SampleAverageMessageHandlingDuration(),
                receivedRate = PerformanceSampler.ForInstance(i).SampleMessagesReceivedRate(),
                sentRate     = PerformanceSampler.ForInstance(i).SampleMessagesSentRate(),
                timeStamp    = DateTime.Now,
            }
                                                                    ).ToList();

            return(Json(samples, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
 public ActionResult Index()
 {
     ViewBag.Instances = PerformanceSampler.ListInstances();
     return(View());
 }