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

Method Update

Source/Editor/Windows/Profiler/Memory.cs:143–180  ·  view source on GitHub ↗

(ref SharedUpdateData sharedData)

Source from the content-addressed store, hash-verified

141
142 /// <inheritdoc />
143 public override void Update(ref SharedUpdateData sharedData)
144 {
145 // Count memory allocated during last frame
146 int nativeMemoryAllocation = 0;
147 int managedMemoryAllocation = sharedData.ManagedMemoryAllocation;
148 var events = sharedData.GetEventsCPU();
149 var length = events?.Length ?? 0;
150 for (int i = 0; i < length; i++)
151 {
152 var ee = events[i].Events;
153 if (ee == null)
154 continue;
155 for (int j = 0; j < ee.Length; j++)
156 {
157 ref var e = ref ee[j];
158 if (e.NameStartsWith("ProfilerWindow"))
159 continue;
160 nativeMemoryAllocation += e.NativeMemoryAllocation;
161 managedMemoryAllocation += e.ManagedMemoryAllocation;
162 }
163 }
164
165 _nativeAllocationsChart.AddSample(nativeMemoryAllocation);
166 _managedAllocationsChart.AddSample(managedMemoryAllocation);
167
168 // Gather memory profiler stats for groups
169 var frame = new FrameData
170 {
171 Usage = ProfilerMemory.GetGroups(0),
172 Peek = ProfilerMemory.GetGroups(1),
173 Count = ProfilerMemory.GetGroups(2),
174 };
175 if (_frames == null)
176 _frames = new SamplesBuffer<FrameData>();
177 if (_groupNames == null)
178 _groupNames = ProfilerMemory.GetGroupNames();
179 _frames.Add(frame);
180 }
181
182 /// <inheritdoc />
183 public override void UpdateView(int selectedFrame, bool showOnlyLastUpdateEvents)

Callers

nothing calls this directly

Calls 6

GetEventsCPUMethod · 0.80
NameStartsWithMethod · 0.80
AddSampleMethod · 0.80
GetGroupsMethod · 0.80
GetGroupNamesMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected