JSC_enableProfiler=true should also cause JSGlobalData to save the profiler output somewhere
https://bugs.webkit.org/show_bug.cgi?id=113144
Source/JavaScriptCore:
Reviewed by Geoffrey Garen.
Added the ability to save profiler output with JSC_enableProfiler=true. It will save it
to the current directory, or JSC_PROFILER_PATH if the latter was specified.
This works by saving the Profiler::Database either when it is destroyed or atexit(),
whichever happens first.
This allows use of the profiler from any WebKit client.
(jscmain):
- profiler/ProfilerDatabase.cpp:
(Profiler):
(JSC::Profiler::Database::Database):
(JSC::Profiler::Database::~Database):
(JSC::Profiler::Database::registerToSaveAtExit):
(JSC::Profiler::Database::addDatabaseToAtExit):
(JSC::Profiler::Database::removeDatabaseFromAtExit):
(JSC::Profiler::Database::performAtExitSave):
(JSC::Profiler::Database::removeFirstAtExitDatabase):
(JSC::Profiler::Database::atExitCallback):
- profiler/ProfilerDatabase.h:
(JSC::Profiler::Database::databaseID):
(Database):
- runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::JSGlobalData):
Source/WTF:
Reviewed by Geoffrey Garen.
I got tired of the fact that getpid(2) is not a syscall on Windows (unless you do
_getpid() I believe), so I wrote a header that abstracts it. I also changed existing
code that uses getpid() to use WTF::getCurrentProcessID().
- GNUmakefile.list.am:
- WTF.gypi:
- WTF.pro:
- WTF.vcproj/WTF.vcproj:
- WTF.xcodeproj/project.pbxproj:
- wtf/CMakeLists.txt:
- wtf/MetaAllocator.cpp:
(WTF::MetaAllocator::dumpProfile):
(WTF):
(WTF::getCurrentProcessID):
(WTF::StringStats::printStats):