MCPcopy Create free account
hub / github.com/defold/defold / AppInitializeProfiler

Function AppInitializeProfiler

engine/profiler/src/profiler.cpp:1061–1093  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1059}
1060
1061static dmExtension::Result AppInitializeProfiler(dmExtension::AppParams* params)
1062{
1063 // Note that the callback might come from a different thread!
1064 g_ProfilerMutex = dmMutex::New();
1065
1066 g_ProfilerPort = dmConfigFile::GetInt(params->m_ConfigFile, "profiler.port", 0);
1067
1068 g_ProfilerCurrentFrame = new dmProfileRender::ProfilerFrame;
1069 dmProfiler::SetEnabled(dmConfigFile::GetInt(params->m_ConfigFile, "profiler.enabled", 1) != 0);
1070
1071 if (!ProfileIsInitialized())
1072 {
1073 ProfileInitialize();
1074 }
1075
1076 if (!ProfileIsInitialized()) // We might use the null implementation
1077 {
1078 delete g_ProfilerCurrentFrame;
1079 g_ProfilerCurrentFrame = 0;
1080 dmMutex::Delete(g_ProfilerMutex);
1081 g_ProfilerMutex = 0;
1082 return dmExtension::RESULT_OK;
1083 }
1084
1085 g_ProfilerThreadSortOrder.SetCapacity(7, 8);
1086 g_ProfilerThreadSortOrder.Put(dmHashString64("Main"), 0);
1087 g_ProfilerThreadSortOrder.Put(dmHashString64("sound"), 1);
1088 g_ProfilerThreadSortOrder.Put(dmHashString64("liveupdate"), 2);
1089
1090 dmExtension::RegisterCallback(dmExtension::CALLBACK_PRE_RENDER, PreRenderProfiler);
1091
1092 return dmExtension::RESULT_OK;
1093}
1094
1095static dmExtension::Result AppFinalizeProfiler(dmExtension::AppParams* params)
1096{

Callers

nothing calls this directly

Calls 9

RegisterCallbackFunction · 0.85
SetEnabledFunction · 0.70
NewFunction · 0.50
GetIntFunction · 0.50
ProfileIsInitializedFunction · 0.50
ProfileInitializeFunction · 0.50
DeleteFunction · 0.50
SetCapacityMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected