MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Update

Method Update

Source/Editor/Windows/Profiler/Network.cs:139–169  ·  view source on GitHub ↗

(ref SharedUpdateData sharedData)

Source from the content-addressed store, hash-verified

137
138 /// <inheritdoc />
139 public override void Update(ref SharedUpdateData sharedData)
140 {
141 // Add this-frame stats
142 _dataSentChart.AddSample(_frameStats.TotalDataSent);
143 _dataReceivedChart.AddSample(_frameStats.TotalDataReceived);
144 if (_stats == null)
145 _stats = new List<NetworkDriverStats>();
146 _stats.Add(_frameStats);
147
148 // Remove all stats older than 1 second
149 while (_stats.Count > 0 && _frameStats.RTT - _stats[0].RTT >= 1.0f)
150 _stats.RemoveAt(0);
151
152 // Calculate average data rates (from last second)
153 var avgStats = new NetworkDriverStats();
154 foreach (var e in _stats)
155 {
156 avgStats.TotalDataSent += e.TotalDataSent;
157 avgStats.TotalDataReceived += e.TotalDataReceived;
158 }
159 //avgStats.TotalDataSent /= (uint)_stats.Count;
160 //avgStats.TotalDataReceived /= (uint)_stats.Count;
161 _dataSentRateChart.AddSample(avgStats.TotalDataSent);
162 _dataReceivedRateChart.AddSample(avgStats.TotalDataReceived);
163
164 // Gather network events
165 var events = ProfilingTools.EventsNetwork;
166 if (_events == null)
167 _events = new SamplesBuffer<ProfilingTools.NetworkEventStat[]>();
168 _events.Add(events);
169 }
170
171 /// <inheritdoc />
172 public override void UpdateView(int selectedFrame, bool showOnlyLastUpdateEvents)

Callers

nothing calls this directly

Calls 3

AddSampleMethod · 0.80
AddMethod · 0.45
RemoveAtMethod · 0.45

Tested by

no test coverage detected