Ignore:
Timestamp:
Feb 11, 2012, 7:21:32 PM (13 years ago)
Author:
[email protected]
Message:

It should be possible to send all JSC debug logging to a file
https://bugs.webkit.org/show_bug.cgi?id=78418

Reviewed by Sam Weinig.

Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog,
and WTF::dataLogV. Changed all debugging- and profiling-related printfs
to use WTF::dataLog() or one of its friends. By default, debug logging
goes to stderr, unless you change the setting in wtf/DataLog.cpp.

Source/JavaScriptCore:

(JSC::LinkBuffer::dumpLinkStatistics):
(JSC::LinkBuffer::dumpCode):

  • assembler/SH4Assembler.h:

(JSC::SH4Assembler::vprintfStdoutInstr):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::printUnaryOp):
(JSC::CodeBlock::printBinaryOp):
(JSC::CodeBlock::printConditionalJump):
(JSC::CodeBlock::printGetByIdOp):
(JSC::CodeBlock::printCallOp):
(JSC::CodeBlock::printPutByIdOp):
(JSC::printGlobalResolveInfo):
(JSC::printStructureStubInfo):
(JSC::CodeBlock::printStructure):
(JSC::CodeBlock::printStructures):
(JSC::CodeBlock::dump):
(JSC::CodeBlock::dumpStatistics):
(JSC::CodeBlock::finalizeUnconditionally):
(JSC::CodeBlock::shouldOptimizeNow):
(JSC::CodeBlock::tallyFrequentExitSites):
(JSC::CodeBlock::dumpValueProfiles):

  • bytecode/Opcode.cpp:

(JSC::OpcodeStats::~OpcodeStats):

  • bytecode/SamplingTool.cpp:

(JSC::SamplingFlags::stop):
(JSC::SamplingRegion::dumpInternal):
(JSC::SamplingTool::dump):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::endBasicBlock):
(JSC::DFG::AbstractState::mergeStateAtTail):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
(JSC::DFG::ByteCodeParser::makeSafe):
(JSC::DFG::ByteCodeParser::makeDivSafe):
(JSC::DFG::ByteCodeParser::handleCall):
(JSC::DFG::ByteCodeParser::handleInlining):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::processPhiStack):
(JSC::DFG::ByteCodeParser::linkBlock):
(JSC::DFG::ByteCodeParser::parseCodeBlock):
(JSC::DFG::ByteCodeParser::parse):

  • dfg/DFGCommon.h:
  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • dfg/DFGGraph.cpp:

(JSC::DFG::printWhiteSpace):
(JSC::DFG::Graph::dumpCodeOrigin):
(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::predictArgumentTypes):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):

  • dfg/DFGOSREntry.cpp:

(JSC::DFG::prepareOSREntry):

  • dfg/DFGOSRExitCompiler.cpp:
  • dfg/DFGOSRExitCompiler32_64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOSRExitCompiler64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOperations.cpp:
  • dfg/DFGPropagator.cpp:

(JSC::DFG::Propagator::fixpoint):
(JSC::DFG::Propagator::propagateArithNodeFlags):
(JSC::DFG::Propagator::propagateArithNodeFlagsForward):
(JSC::DFG::Propagator::propagateArithNodeFlagsBackward):
(JSC::DFG::Propagator::propagateNodePredictions):
(JSC::DFG::Propagator::propagatePredictionsForward):
(JSC::DFG::Propagator::propagatePredictionsBackward):
(JSC::DFG::Propagator::doRoundOfDoubleVoting):
(JSC::DFG::Propagator::fixupNode):
(JSC::DFG::Propagator::fixup):
(JSC::DFG::Propagator::startIndexForChildren):
(JSC::DFG::Propagator::endIndexForPureCSE):
(JSC::DFG::Propagator::setReplacement):
(JSC::DFG::Propagator::eliminate):
(JSC::DFG::Propagator::performNodeCSE):
(JSC::DFG::Propagator::localCSE):
(JSC::DFG::Propagator::allocateVirtualRegisters):
(JSC::DFG::Propagator::performBlockCFA):
(JSC::DFG::Propagator::performForwardCFA):

  • dfg/DFGRegisterBank.h:

(JSC::DFG::RegisterBank::dump):

  • dfg/DFGScoreBoard.h:

(JSC::DFG::ScoreBoard::dump):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::dump):
(JSC::DFG::SpeculativeJIT::checkConsistency):
(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
(JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
(JSC::DFG::SpeculativeJIT::fillSpeculateCell):
(JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
(JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
(JSC::DFG::SpeculativeJIT::fillSpeculateCell):
(JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):

  • heap/Heap.cpp:

(JSC::Heap::destroy):

  • heap/MarkedBlock.h:
  • interpreter/CallFrame.cpp:

(JSC::CallFrame::dumpCaller):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::dumpRegisters):

  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):
(JSC::JIT::privateCompile):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • profiler/Profile.cpp:

(JSC::Profile::debugPrintData):
(JSC::Profile::debugPrintDataSampleStyle):

  • profiler/ProfileNode.cpp:

(JSC::ProfileNode::debugPrintData):
(JSC::ProfileNode::debugPrintDataSampleStyle):

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::dumpRegExpTrace):

  • runtime/RegExp.cpp:

(JSC::RegExp::matchCompareWithInterpreter):

  • runtime/SamplingCounter.cpp:

(JSC::AbstractSamplingCounter::dump):

  • runtime/SamplingCounter.h:

(JSC::DeletableSamplingCounter::~DeletableSamplingCounter):

  • runtime/ScopeChain.cpp:

(JSC::ScopeChainNode::print):

  • runtime/Structure.cpp:

(JSC::Structure::dumpStatistics):
(JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger):

  • tools/CodeProfile.cpp:

(JSC::CodeProfile::report):

  • tools/ProfileTreeNode.h:

(JSC::ProfileTreeNode::dumpInternal):

  • wtf/CMakeLists.txt:
  • wtf/DataLog.cpp: Added.

(WTF):
(WTF::initializeLogFileOnce):
(WTF::initializeLogFile):
(WTF::dataFile):
(WTF::dataLogV):
(WTF::dataLog):

  • wtf/DataLog.h: Added.

(WTF):

  • wtf/HashTable.cpp:

(WTF::HashTableStats::~HashTableStats):

  • wtf/MetaAllocator.cpp:

(WTF::MetaAllocator::dumpProfile):

  • wtf/text/WTFString.cpp:

(String::show):

  • yarr/YarrInterpreter.cpp:

(JSC::Yarr::ByteCompiler::dumpDisjunction):

Source/WebCore:

No new tests because behavior is unchanged.

  • ForwardingHeaders/wtf/DataLog.h: Added.

Source/WTF:

  • WTF.pro:
Location:
trunk/Source/JavaScriptCore/profiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/profiler/Profile.cpp

    r95901 r107499  
    2929#include "ProfileNode.h"
    3030#include <stdio.h>
     31#include <wtf/DataLog.h>
    3132
    3233namespace JSC {
     
    103104void Profile::debugPrintData() const
    104105{
    105     printf("Call graph:\n");
     106    dataLog("Call graph:\n");
    106107    m_head->debugPrintData(0);
    107108}
     
    119120
    120121    FunctionCallHashCount countedFunctions;
    121     printf("Call graph:\n");
     122    dataLog("Call graph:\n");
    122123    m_head->debugPrintDataSampleStyle(0, countedFunctions);
    123124
    124     printf("\nTotal number in stack:\n");
     125    dataLog("\nTotal number in stack:\n");
    125126    NameCountPairVector sortedFunctions(countedFunctions.size());
    126127    copyToVector(countedFunctions, sortedFunctions);
     
    128129    std::sort(sortedFunctions.begin(), sortedFunctions.end(), functionNameCountPairComparator);
    129130    for (NameCountPairVector::iterator it = sortedFunctions.begin(); it != sortedFunctions.end(); ++it)
    130         printf("        %-12d%s\n", (*it).second, UString((*it).first).utf8().data());
     131        dataLog("        %-12d%s\n", (*it).second, UString((*it).first).utf8().data());
    131132
    132     printf("\nSort by top of stack, same collapsed (when >= 5):\n");
     133    dataLog("\nSort by top of stack, same collapsed (when >= 5):\n");
    133134}
    134135#endif
  • trunk/Source/JavaScriptCore/profiler/ProfileNode.cpp

    r95901 r107499  
    3333#include <stdio.h>
    3434#include <wtf/DateMath.h>
     35#include <wtf/DataLog.h>
    3536#include <wtf/text/StringHash.h>
    3637
     
    294295    // Print function names
    295296    for (int i = 0; i < indentLevel; ++i)
    296         printf("  ");
    297 
    298     printf("Function Name %s %d SelfTime %.3fms/%.3f%% TotalTime %.3fms/%.3f%% VSelf %.3fms VTotal %.3fms Visible %s Next Sibling %s\n",
     297        dataLog("  ");
     298
     299    dataLog("Function Name %s %d SelfTime %.3fms/%.3f%% TotalTime %.3fms/%.3f%% VSelf %.3fms VTotal %.3fms Visible %s Next Sibling %s\n",
    299300        functionName().utf8().data(),
    300301        m_numberOfCalls, m_actualSelfTime, selfPercent(), m_actualTotalTime, totalPercent(),
     
    313314double ProfileNode::debugPrintDataSampleStyle(int indentLevel, FunctionCallHashCount& countedFunctions) const
    314315{
    315     printf("    ");
     316    dataLog("    ");
    316317
    317318    // Print function names
     
    320321    if (indentLevel) {
    321322        for (int i = 0; i < indentLevel; ++i)
    322             printf("  ");
     323            dataLog("  ");
    323324
    324325         countedFunctions.add(functionName().impl());
    325326
    326         printf("%.0f %s\n", sampleCount ? sampleCount : 1, name);
     327        dataLog("%.0f %s\n", sampleCount ? sampleCount : 1, name);
    327328    } else
    328         printf("%s\n", name);
     329        dataLog("%s\n", name);
    329330
    330331    ++indentLevel;
     
    338339    // Print remainder of samples to match sample's output
    339340    if (sumOfChildrensCount < sampleCount) {
    340         printf("    ");
     341        dataLog("    ");
    341342        while (indentLevel--)
    342             printf("  ");
    343 
    344         printf("%.0f %s\n", sampleCount - sumOfChildrensCount, functionName().utf8().data());
     343            dataLog("  ");
     344
     345        dataLog("%.0f %s\n", sampleCount - sumOfChildrensCount, functionName().utf8().data());
    345346    }
    346347
Note: See TracChangeset for help on using the changeset viewer.