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

Function InitProfilerMemory

Source/Engine/Profiler/ProfilerMemory.cpp:228–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228void InitProfilerMemory(const Char* cmdLine, int32 stage)
229{
230 if (stage == 1) // Post-platform init
231 {
232 // Init constant memory
233 PROFILE_MEM_INC(ProgramSize, Platform::GetMemoryStats().ProgramSizeMemory);
234 UPDATE_PEEK(ProfilerMemory::Groups::ProgramSize);
235
236 return;
237 }
238
239 // Check for command line option (memory profiling affects performance thus not active by default)
240 ProfilerMemory::Enabled = StringUtils::FindIgnoreCase(cmdLine, TEXT("-mem"));
241
242 // Init hierarchy
243#define INIT_PARENT(parent, child) GroupParents[(int32)ProfilerMemory::Groups::child] = (uint8)ProfilerMemory::Groups::parent
244 INIT_PARENT(Engine, EngineThreading);
245 INIT_PARENT(Engine, EngineDelegate);
246 INIT_PARENT(Engine, EngineDebug);
247 INIT_PARENT(Malloc, MallocArena);
248 INIT_PARENT(Graphics, GraphicsTextures);
249 INIT_PARENT(Graphics, GraphicsRenderTargets);
250 INIT_PARENT(Graphics, GraphicsCubeMaps);
251 INIT_PARENT(Graphics, GraphicsVolumeTextures);
252 INIT_PARENT(Graphics, GraphicsBuffers);
253 INIT_PARENT(Graphics, GraphicsVertexBuffers);
254 INIT_PARENT(Graphics, GraphicsIndexBuffers);
255 INIT_PARENT(Graphics, GraphicsMeshes);
256 INIT_PARENT(Graphics, GraphicsShaders);
257 INIT_PARENT(Graphics, GraphicsMaterials);
258 INIT_PARENT(Graphics, GraphicsCommands);
259 INIT_PARENT(Animations, AnimationsData);
260 INIT_PARENT(Content, ContentAssets);
261 INIT_PARENT(Content, ContentFiles);
262 INIT_PARENT(Level, LevelFoliage);
263 INIT_PARENT(Level, LevelTerrain);
264 INIT_PARENT(Navigation, NavigationMesh);
265 INIT_PARENT(Navigation, NavigationBuilding);
266 INIT_PARENT(Physics, PhysicsCloth);
267 INIT_PARENT(Scripting, ScriptingVisual);
268 INIT_PARENT(Scripting, ScriptingCSharp);
269 INIT_PARENT(ScriptingCSharp, ScriptingCSharpGCCommitted);
270 INIT_PARENT(ScriptingCSharp, ScriptingCSharpGCHeap);
271#undef INIT_PARENT
272
273 // Init group names
274 for (int32 i = 0; i < GROUPS_COUNT; i++)
275 {
276 const char* name = ScriptingEnum::GetName((ProfilerMemory::Groups)i);
277 GroupNames[i].Set(name, true);
278 }
279#define RENAME_GROUP(group, name) GroupNames[(int32)ProfilerMemory::Groups::group].Set(name)
280 RENAME_GROUP(GraphicsRenderTargets, "Graphics/RenderTargets");
281 RENAME_GROUP(GraphicsCubeMaps, "Graphics/CubeMaps");
282 RENAME_GROUP(GraphicsVolumeTextures, "Graphics/VolumeTextures");
283 RENAME_GROUP(GraphicsVertexBuffers, "Graphics/VertexBuffers");
284 RENAME_GROUP(GraphicsIndexBuffers, "Graphics/IndexBuffers");
285 RENAME_GROUP(ScriptingCSharpGCCommitted, "Scripting/CSharp/GC/Committed");

Callers 1

OnInitMethod · 0.85

Calls 1

SetMethod · 0.45

Tested by

no test coverage detected