Skip to content
  • fpizlo@apple.com's avatar
    JSC_enableProfiler=true should also cause JSGlobalData to save the profiler output somewhere · 7183460c
    fpizlo@apple.com authored
    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.
    
    * jsc.cpp:
    (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/ProcessID.h: Added.
    (WTF):
    (WTF::getCurrentProcessID):
    * wtf/text/StringImpl.cpp:
    (WTF::StringStats::printStats):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146932 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    7183460c