Ticket #1862: profiler2.3.patch
File profiler2.3.patch, 4.5 KB (added by , 10 years ago) |
---|
-
binaries/data/config/default.cfg
326 326 ; > PROFILER 327 327 hotkey.profile.toggle = "F11" ; Enable/disable real-time profiler 328 328 hotkey.profile.save = "Shift+F11" ; Save current profiler data to logs/profile.txt 329 hotkey.profile2. enable = "F11" ; Enable HTTP/GPU modes for new profiler329 hotkey.profile2.toggle = "Ctrl+F11" ; Enable/disable HTTP/GPU modes for new profiler 330 330 331 profiler2. http.autoenable = false; Enable HTTP server output at startup (default off for security/performance)331 profiler2.autoenable = false ; Enable HTTP server output at startup (default off for security/performance) 332 332 profiler2.script.enable = false ; Enable Javascript profiling. Needs to be set before startup and can't be changed later. (default off for performance) 333 profiler2.gpu.autoenable = false ; Enable GPU timing at startup (default off for performance/compatibility)334 333 profiler2.gpu.arb.enable = true ; Allow GL_ARB_timer_query timing mode when available 335 334 profiler2.gpu.ext.enable = true ; Allow GL_EXT_timer_query timing mode when available 336 335 profiler2.gpu.intel.enable = true ; Allow GL_INTEL_performance_queries timing mode when available -
source/main.cpp
161 161 #endif 162 162 return IN_HANDLED; 163 163 } 164 else if (hotkey == "profile2. enable")164 else if (hotkey == "profile2.toggle") 165 165 { 166 g_Profiler2.EnableGPU(); 167 g_Profiler2.EnableHTTP(); 166 g_Profiler2.Toggle(); 168 167 return IN_HANDLED; 169 168 } 170 169 break; -
source/ps/GameSetup/GameSetup.cpp
914 914 // Optionally start profiler HTTP output automatically 915 915 // (By default it's only enabled by a hotkey, for security/performance) 916 916 bool profilerHTTPEnable = false; 917 CFG_GET_VAL("profiler2. http.autoenable", Bool, profilerHTTPEnable);917 CFG_GET_VAL("profiler2.autoenable", Bool, profilerHTTPEnable); 918 918 if (profilerHTTPEnable) 919 919 g_Profiler2.EnableHTTP(); 920 920 … … 950 950 // Optionally start profiler GPU timings automatically 951 951 // (By default it's only enabled by a hotkey, for performance/compatibility) 952 952 bool profilerGPUEnable = false; 953 CFG_GET_VAL("profiler2. gpu.autoenable", Bool, profilerGPUEnable);953 CFG_GET_VAL("profiler2.autoenable", Bool, profilerGPUEnable); 954 954 if (profilerGPUEnable) 955 955 g_Profiler2.EnableGPU(); 956 956 -
source/ps/Profiler2.cpp
157 157 void CProfiler2::EnableHTTP() 158 158 { 159 159 ENSURE(m_Initialised); 160 LOGMESSAGERENDER(L"Starting profiler2 HTTP server"); 160 161 161 162 // Ignore multiple enablings 162 163 if (m_MgContext) … … 175 176 { 176 177 ENSURE(m_Initialised); 177 178 if (!m_GPU) 179 { 180 LOGMESSAGERENDER(L"Starting profiler2 GPU mode"); 178 181 InitialiseGPU(); 179 182 } 183 } 180 184 181 185 void CProfiler2::ShutdownGPU() 182 186 { 187 LOGMESSAGERENDER(L"Shutting down profiler2 GPU mode"); 183 188 SAFE_DELETE(m_GPU); 184 189 } 185 190 191 void CProfiler2::ShutDownHTTP() 192 { 193 LOGMESSAGERENDER(L"Shutting down profiler2 HTTP server"); 194 if (m_MgContext) 195 { 196 mg_stop(m_MgContext); 197 m_MgContext = NULL; 198 } 199 } 200 201 void CProfiler2::Toggle() 202 { 203 //TODO: Maybe we can open the browser to the profiler page automatically 204 if(m_GPU && m_MgContext) 205 { 206 ShutdownGPU(); 207 ShutDownHTTP(); 208 } 209 else if(!m_GPU && !m_MgContext) 210 { 211 EnableGPU(); 212 EnableHTTP(); 213 } 214 } 215 186 216 void CProfiler2::Shutdown() 187 217 { 188 218 ENSURE(m_Initialised); -
source/ps/Profiler2.h
276 276 void ShutdownGPU(); 277 277 278 278 /** 279 * Call in main thread to shut down the profiler's HTTP server 280 */ 281 void ShutDownHTTP(); 282 283 /** 284 * Call in main thread to enable/disable the profiler 285 */ 286 void Toggle(); 287 288 /** 279 289 * Call in main thread to shut everything down. 280 290 * All other profiled threads should have been terminated already. 281 291 */