Ignore:
Timestamp:
Apr 19, 2016, 7:24:53 PM (9 years ago)
Author:
[email protected]
Message:

allow jsc shell to dump sampling profiler data
https://bugs.webkit.org/show_bug.cgi?id=156725

Reviewed by Benjamin Poulain.

This patch adds a '--reportSamplingProfilerData' option to the
JSC shell which will enable the sampling profiler and dump
its data at the end of execution. The dump will include the
40 hottest functions and the 80 hottest bytecode locations.
If you're using this option to debug, it's easy to just hack
on the code to make it dump more or less information.

  • jsc.cpp:

(CommandLine::parseArguments):
(jscmain):

  • runtime/Options.h:
  • runtime/SamplingProfiler.cpp:

(JSC::SamplingProfiler::processUnverifiedStackTraces):
(JSC::SamplingProfiler::stackTracesAsJSON):
(JSC::SamplingProfiler::reportTopFunctions):
(JSC::SamplingProfiler::reportTopBytecodes):

  • runtime/SamplingProfiler.h:

(JSC::SamplingProfiler::StackFrame::hasExpressionInfo):
(JSC::SamplingProfiler::StackFrame::hasBytecodeIndex):
(JSC::SamplingProfiler::StackFrame::hasCodeBlockHash):
(JSC::SamplingProfiler::setStopWatch):

File:
1 edited

Legend:

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

    r199647 r199754  
    661661    bool m_profile { false };
    662662    String m_profilerOutput;
     663    bool m_dumpSamplingProfilerData { false };
    663664
    664665    void parseArguments(int, char**);
     
    21672168            continue;
    21682169        }
     2170        if (!strcmp(arg, "--reportSamplingProfilerData")) {
     2171            JSC::Options::useSamplingProfiler() = true;
     2172            JSC::Options::collectSamplingProfilerDataForJSCShell() = true;
     2173            m_dumpSamplingProfilerData = true;
     2174            continue;
     2175        }
    21692176
    21702177        // See if the -- option is a JSC VM option.
     
    22672274    }
    22682275
     2276    if (options.m_dumpSamplingProfilerData) {
     2277        vm->samplingProfiler()->reportTopFunctions();
     2278        vm->samplingProfiler()->reportTopBytecodes();
     2279    }
     2280
    22692281    printSuperSamplerState();
    22702282
Note: See TracChangeset for help on using the changeset viewer.