| 1059 | } |
| 1060 | |
| 1061 | static 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 | |
| 1095 | static dmExtension::Result AppFinalizeProfiler(dmExtension::AppParams* params) |
| 1096 | { |
nothing calls this directly
no test coverage detected