Beispiel #1
0
        protected override void OnUpdate()
        {
            using (completingJobsMarker.Auto())
            {
                JobHandle.CompleteAll(replicationHandles);
            }

            replicationHandles.Clear();

            using (updateQueueMarker.Auto())
            {
                foreach (var componentQueue in componentQueues)
                {
                    while (componentQueue.TryDequeue(out var updateToSend))
                    {
                        worker.MessagesToSend.AddSerializedComponentUpdate(updateToSend);
                    }

                    componentQueue.Dispose();
                }
            }

            worker.SendMessages(netFrameStats);

            networkStatisticsSystem.AddOutgoingSample(netFrameStats);
            netFrameStats.Clear();

            componentQueues.Clear();
        }
Beispiel #2
0
        public void FrameStats_is_summed_in_summary_stats_and_wraps_correctly()
        {
            var netStats      = new NetStats(5);
            var netFrameStats = new NetFrameStats();
            var dataInjector  = netFrameStats.TestInjector;

            var messageType = MessageTypeUnion.Update(10);
            var direction   = Direction.Incoming;

            for (uint i = 1; i <= 5; i++)
            {
                dataInjector.AddComponentUpdate(10, i);
                netStats.SetFrameStats(netFrameStats, direction);
                netStats.FinishFrame();
                netFrameStats.Clear();
            }

            // After the for loop, for the correct direction and message type.
            //           buffer - [5, 4, 3, 2, 1]
            //                 nextInsertIndex ^

            var(singleFrameData, _) = netStats.GetSummary(messageType, 1, direction);
            Assert.AreEqual(1, singleFrameData.Count);
            Assert.AreEqual(5, singleFrameData.Size);

            var(twoFrameData, _) = netStats.GetSummary(messageType, 2, direction);
            Assert.AreEqual(2, twoFrameData.Count);
            Assert.AreEqual(5 + 4, twoFrameData.Size);

            var(threeFrameData, _) = netStats.GetSummary(messageType, 3, direction);
            Assert.AreEqual(3, threeFrameData.Count);
            Assert.AreEqual(5 + 4 + 3, threeFrameData.Size);
        }
Beispiel #3
0
 public void Clear()
 {
     updates.Clear();
     requests.Clear();
     responses.Clear();
     failures.Clear();
     reserveEntityIdsRequests.Clear();
     createEntityRequests.Clear();
     deleteEntityRequests.Clear();
     entityQueryRequests.Clear();
     metricsToSend.Clear();
     logMessages.Clear();
     netFrameStats.Clear();
 }
Beispiel #4
0
 protected override void OnUpdate()
 {
     worker.SendMessages(netFrameStats);
     networkStatisticsSystem.AddOutgoingSample(netFrameStats);
     netFrameStats.Clear();
 }