Beispiel #1
0
        private void ProfilerServiceOnOnProfilerStopped(object sender, ProfilerStoppedEvent e)
        {
            if (_networkChunkProfilers.TryRemove(e.Id, out _))
            {
                NetworkChunkProcessing.Record((long)e.ElapsedTime.TotalMilliseconds, TimeUnit.Milliseconds);
            }
            else if (_chunkProfilers.TryRemove(e.Id, out _))
            {
                ChunkUpdateTime.Record((long)e.Profiler.DurationMilliseconds, TimeUnit.Milliseconds);

                var timings = new Stack <Timing>();
                timings.Push(e.Profiler.Root);

                while (timings.Count > 0)
                {
                    var timing = timings.Pop();
                    switch (timing.Name)
                    {
                    case "chunk.sections":
                        ChunkSectionUpdatesTimer.Record((long)timing.DurationMilliseconds.Value, TimeUnit.Milliseconds);
                        break;

                    case "chunk.buffer":
                        ChunkBufferUpdateTimer.Record((long)timing.DurationMilliseconds.Value,
                                                      TimeUnit.Milliseconds);
                        break;

                    case "chunk.meshing":
                        ChunkMeshTimer.Record((long)timing.DurationMilliseconds.Value, TimeUnit.Milliseconds);
                        break;

                    case "chunk.buffer.check":
                        ChunkBufferCreationTimer.Record((long)timing.DurationMilliseconds.Value, TimeUnit.Milliseconds);
                        break;

                    case "chunk.neighboring":
                        ChunkSectionNeighborTimer.Record((long)timing.DurationMilliseconds.Value, TimeUnit.Milliseconds);
                        break;
                    }

                    if (timing.HasChildren)
                    {
                        var children = timing.Children;
                        for (var i = children.Count - 1; i >= 0; i--)
                        {
                            timings.Push(children[i]);
                        }
                    }
                }
            }
            else
            {
                Log.Warn($"Could not remove timer!");
            }
        }
Beispiel #2
0
 private void ProfilerServiceOnOnProfilerStopped(object sender, ProfilerStoppedEvent e)
 {
     if (_networkChunkProfilers.TryRemove(e.Id, out _))
     {
         NetworkChunkProcessing.Record((long)e.ElapsedTime.TotalMilliseconds, TimeUnit.Milliseconds);
     }
     else if (_chunkProfilers.TryRemove(e.Id, out _))
     {
         ChunkUpdateTime.Record((long)e.ElapsedTime.TotalMilliseconds, TimeUnit.Milliseconds);
     }
     else
     {
         Log.Warn($"Could not remove timer!");
     }
 }