Ignore:
Timestamp:
Mar 26, 2013, 2:43:27 PM (12 years ago)
Author:
[email protected]
Message:

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.

  • 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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r141651 r146932  
    765765    int result;
    766766
    767     if (options.m_profile)
     767    if (options.m_profile && !globalData->m_perBytecodeProfiler)
    768768        globalData->m_perBytecodeProfiler = adoptPtr(new Profiler::Database(*globalData));
    769769   
Note: See TracChangeset for help on using the changeset viewer.