Index: source/scriptinterface/ScriptInterface.cpp =================================================================== --- source/scriptinterface/ScriptInterface.cpp +++ source/scriptinterface/ScriptInterface.cpp @@ -27,6 +27,7 @@ #include "ps/CLogger.h" #include "ps/Filesystem.h" #include "ps/Profile.h" +#include "ps/Profiler2.h" #include "ps/utf16string.h" #include @@ -279,6 +280,18 @@ return true; } +bool Profile2Toggle(JSContext* UNUSED(cx), uint UNUSED(argc), JS::Value* UNUSED(vp)) +{ + g_Profiler2.Toggle(); + return true; +} + +bool Profile2SaveToFile(JSContext* UNUSED(cx), uint UNUSED(argc), JS::Value* UNUSED(vp)) +{ + g_Profiler2.SaveToFile(); + return true; +} + // Math override functions: // boost::uniform_real is apparently buggy in Boost pre-1.47 - for integer generators @@ -348,6 +361,8 @@ Register("ProfileStart", ::ProfileStart, 1); Register("ProfileStop", ::ProfileStop, 0); Register("ProfileAttribute", ::ProfileAttribute, 1); + Register("Profile2Toggle", ::Profile2Toggle, 0); + Register("Profile2SaveToFile", ::Profile2SaveToFile, 0); m_context->RegisterRealm(JS::GetObjectRealmOrNull(m_glob)); }