Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: source/graphics/MapGenerator.cpp
- ===================================================================
- --- source/graphics/MapGenerator.cpp (revision 13133)
- +++ source/graphics/MapGenerator.cpp (working copy)
- @@ -64,6 +64,8 @@
- {
- debug_SetThreadName("MapGenerator");
- + g_Profiler2.RegisterCurrentThread("mapgenerator");
- +
- CMapGeneratorWorker* self = static_cast<CMapGeneratorWorker*>(data);
- self->m_ScriptInterface = new ScriptInterface("RMS", "MapGenerator", ScriptInterface::CreateRuntime(RMS_RUNTIME_SIZE));
- Index: source/scriptinterface/ScriptInterface.cpp
- ===================================================================
- --- source/scriptinterface/ScriptInterface.cpp (revision 13133)
- +++ source/scriptinterface/ScriptInterface.cpp (working copy)
- @@ -436,6 +436,34 @@
- return JS_TRUE;
- }
- +JSBool GCCallback(JSContext* UNUSED(cx), JSGCStatus status)
- +{
- + switch(status)
- + {
- + case JSGC_BEGIN:
- + if (CProfileManager::IsInitialised() && ThreadUtil::IsMainThread())
- + g_Profiler.Start("JS GC");
- +
- + g_Profiler2.RecordRegionEnter("JS GC");
- + break;
- + case JSGC_MARK_END:
- + g_Profiler2.RecordEvent("JS GC mark end");
- + break;
- + case JSGC_FINALIZE_END:
- + g_Profiler2.RecordEvent("JS GC finalize end");
- + break;
- + case JSGC_END:
- + if (CProfileManager::IsInitialised() && ThreadUtil::IsMainThread())
- + g_Profiler.Stop();
- +
- + g_Profiler2.RecordRegionLeave("JS GC");
- + break;
- + default:
- + debug_warn(L"Invalid status in GCCallback");
- + }
- + return JS_TRUE;
- +}
- +
- // Math override functions:
- // boost::uniform_real is apparently buggy in Boost pre-1.47 - for integer generators
- @@ -488,6 +516,8 @@
- JS_SetErrorReporter(m_cx, ErrorReporter);
- + JS_SetGCCallback(m_cx, GCCallback);
- +
- uint32 options = 0;
- options |= JSOPTION_STRICT; // "warn on dubious practice"
- options |= JSOPTION_XML; // "ECMAScript for XML support: parse <!-- --> as a token"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement