// 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(); }
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)); }
public ActionResult Index() { ViewBag.Instances = PerformanceSampler.ListInstances(); return(View()); }