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

Method UpdateTableInner

Source/Editor/Windows/Profiler/Memory.cs:216–293  ·  view source on GitHub ↗
(int selectedFrame)

Source from the content-addressed store, hash-verified

214 }
215
216 private unsafe void UpdateTableInner(int selectedFrame)
217 {
218 if (_frames.Count == 0)
219 return;
220 if (_warningText != null)
221 _warningText.Visible = true;
222 var frame = _frames.Get(selectedFrame);
223 var totalUage = frame.Usage.Values0[(int)ProfilerMemory.Groups.TotalTracked];
224 var totalPeek = frame.Peek.Values0[(int)ProfilerMemory.Groups.TotalTracked];
225 var totalCount = frame.Count.Values0[(int)ProfilerMemory.Groups.TotalTracked];
226
227 // Sort by memory size
228 if (_groupOrder == null)
229 _groupOrder = new int[(int)ProfilerMemory.Groups.MAX];
230 for (int i = 0; i < (int)ProfilerMemory.Groups.MAX; i++)
231 _groupOrder[i] = i;
232 Array.Sort(_groupOrder, (x, y) =>
233 {
234 var tmp = _frames.Get(selectedFrame);
235 return tmp.Usage.Values0[y].CompareTo(tmp.Usage.Values0[x]);
236 });
237
238 // Add rows
239 var rowColor2 = Style.Current.Background * 1.4f;
240 for (int i = 0; i < (int)ProfilerMemory.Groups.MAX; i++)
241 {
242 var group = _groupOrder[i];
243 var groupUsage = frame.Usage.Values0[group];
244 if (groupUsage <= 0)
245 continue;
246 var groupPeek = frame.Peek.Values0[group];
247 var groupCount = frame.Count.Values0[group];
248
249 Row row;
250 if (_tableRowsCache.Count != 0)
251 {
252 var last = _tableRowsCache.Count - 1;
253 row = _tableRowsCache[last];
254 _tableRowsCache.RemoveAt(last);
255 }
256 else
257 {
258 row = new Row
259 {
260 Values = new object[4],
261 BackgroundColors = new Color[4],
262 };
263 }
264 {
265 // Group
266 row.Values[0] = _groupNames[group];
267
268 // Usage
269 row.Values[1] = groupUsage;
270 row.BackgroundColors[1] = Color.Red.AlphaMultiplied(Mathf.Min(1, (float)groupUsage / totalUage) * 0.5f);
271
272 // Peek
273 row.Values[2] = groupPeek;

Callers

nothing calls this directly

Calls 6

AlphaMultipliedMethod · 0.80
GetMethod · 0.45
SortMethod · 0.45
CompareToMethod · 0.45
RemoveAtMethod · 0.45
MinMethod · 0.45

Tested by

no test coverage detected