Ignore:
Timestamp:
Apr 16, 2008, 12:08:03 PM (17 years ago)
Author:
[email protected]
Message:

2008-04-16 Kevin McCullough <[email protected]>

Reviewed by Sam and Geoff.

-<rdar://problem/5770054> JavaScript profiler (10928)
Inital profiler prototype

  • GNUmakefile.am: Added new files to project
  • JavaScriptCore.pri: Ditto
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto
  • JavaScriptCore.xcodeproj/project.pbxproj: Ditto
  • JavaScriptCoreSources.bkl: Ditto
  • kjs/config.h: Put compiling flag in here.
  • kjs/function.cpp: Instrument calling the function eval(). (KJS::eval):
  • kjs/interpreter.cpp: Instrument evaluating global scopes. (KJS::Interpreter::evaluate):
  • kjs/object.cpp: Instrument JS function calls. (KJS::JSObject::call):
  • profiler: Added.
  • profiler/FunctionCallProfile.cpp: Added. (KJS::FunctionCallProfile::FunctionCallProfile): (KJS::FunctionCallProfile::~FunctionCallProfile): (KJS::FunctionCallProfile::willExecute): Call right before the JS function or executing context is executed to start the profiler's timer. (KJS::FunctionCallProfile::didExecute): Call right after the JS function or executing context is executed to stop the profiler's timer. (KJS::FunctionCallProfile::addChild): Add a child to the current FunctionCallProfile if it isn't already a child of the current FunctionalCallProfile. (KJS::FunctionCallProfile::findChild): Return the child that matches the given name if there is one. (KJS::FunctionCallProfile::printDataSampleStyle): Print the current profiled information in a format that matches sample's output.
  • profiler/FunctionCallProfile.h: Added. (KJS::FunctionCallProfile::FunctionCallProfile): (KJS::FunctionCallProfile::~FunctionCallProfile): (KJS::FunctionCallProfile::functionName): (KJS::FunctionCallProfile::microSecs):
  • profiler/Profiler.cpp: Added. (KJS::Profiler::profiler): (KJS::Profiler::sharedProfiler): Return global singleton (may change due to multi-threading concerns) (KJS::Profiler::startProfiling): Don't start collecting profiling information until the user starts the profiler. Also don't clear old prfiled data until the profiler is restarted. (KJS::Profiler::stopProfiling): Stop collecting profile information. (KJS::Profiler::willExecute): Same as above. (KJS::Profiler::didExecute): Same as above. (KJS::Profiler::insertStackNamesInTree): Follow the stack of the given names and if a sub-stack is not in the current tree, add it. (KJS::Profiler::getStackNames): Get the names from the different passed in parameters and order them as a stack. (KJS::Profiler::getFunctionName): Get the function name from the given parameter. (KJS::Profiler::printDataSampleStyle): Print the current profiled information in a format that matches sample's output. (KJS::Profiler::debugLog):
  • profiler/Profiler.h: Added. (KJS::Profiler::Profiler):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r31936 r31949  
    187187                93E26BFE08B151D400F85226 /* ucpinternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E26BFC08B151D400F85226 /* ucpinternal.h */; };
    188188                93F0B3AC09BB4DC00068FCE3 /* Parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F0B3AA09BB4DC00068FCE3 /* Parser.h */; settings = {ATTRIBUTES = (Private, ); }; };
     189                95AB83420DA4322500BC83F3 /* Profiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95AB832E0DA42CAD00BC83F3 /* Profiler.cpp */; };
     190                95AB83480DA432EB00BC83F3 /* Profiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 95AB832F0DA42CAD00BC83F3 /* Profiler.h */; };
     191                95AB83560DA43C3000BC83F3 /* FunctionCallProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95AB83540DA43B4400BC83F3 /* FunctionCallProfile.cpp */; };
     192                95AB83570DA43C3000BC83F3 /* FunctionCallProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 95AB83550DA43B4400BC83F3 /* FunctionCallProfile.h */; };
    189193                95C18D490C90E82600E72F73 /* JSRetainPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 95C18D3E0C90E7EF00E72F73 /* JSRetainPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
    190194                A8E894320CD0602400367179 /* JSCallbackObjectFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */; };
     
    491495                93F0B3AA09BB4DC00068FCE3 /* Parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Parser.h; sourceTree = "<group>"; };
    492496                93F1981A08245AAE001E9ABC /* keywords.table */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = text; path = keywords.table; sourceTree = "<group>"; tabWidth = 8; };
     497                95AB832E0DA42CAD00BC83F3 /* Profiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Profiler.cpp; path = profiler/Profiler.cpp; sourceTree = "<group>"; };
     498                95AB832F0DA42CAD00BC83F3 /* Profiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Profiler.h; path = profiler/Profiler.h; sourceTree = "<group>"; };
     499                95AB83540DA43B4400BC83F3 /* FunctionCallProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FunctionCallProfile.cpp; path = profiler/FunctionCallProfile.cpp; sourceTree = "<group>"; };
     500                95AB83550DA43B4400BC83F3 /* FunctionCallProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FunctionCallProfile.h; path = profiler/FunctionCallProfile.h; sourceTree = "<group>"; };
    493501                95C18D3E0C90E7EF00E72F73 /* JSRetainPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRetainPtr.h; sourceTree = "<group>"; };
    494502                A785E3030D9341AB00953772 /* ExecStateInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecStateInlines.h; sourceTree = "<group>"; };
     
    638646                                65162EF108E6A21C007556CD /* wtf */,
    639647                                65417203039E01F90058BFEB /* pcre */,
     648                                95AB831A0DA42C6900BC83F3 /* profiler */,
    640649                                65417200039E01BA0058BFEB /* kjs */,
    641650                                1432EBD70A34CAD400717B9F /* API */,
     
    957966                        tabWidth = 4;
    958967                        usesTabs = 0;
     968                };
     969                95AB831A0DA42C6900BC83F3 /* profiler */ = {
     970                        isa = PBXGroup;
     971                        children = (
     972                                95AB83540DA43B4400BC83F3 /* FunctionCallProfile.cpp */,
     973                                95AB83550DA43B4400BC83F3 /* FunctionCallProfile.h */,
     974                                95AB832E0DA42CAD00BC83F3 /* Profiler.cpp */,
     975                                95AB832F0DA42CAD00BC83F3 /* Profiler.h */,
     976                        );
     977                        name = profiler;
     978                        sourceTree = "<group>";
    959979                };
    960980                E195678D09E7CF1200B89D13 /* unicode */ = {
     
    11211141                                E1A862AB0D7EBB7D001EC6AA /* Collator.h in Headers */,
    11221142                                E17863400D9BEC0000D74E75 /* InitializeThreading.h in Headers */,
     1143                                95AB83480DA432EB00BC83F3 /* Profiler.h in Headers */,
     1144                                95AB83570DA43C3000BC83F3 /* FunctionCallProfile.h in Headers */,
    11231145                                E1B7C8BE0DA3A3360074B0DC /* ThreadSpecific.h in Headers */,
    11241146                                06D358B20DAADA93003B174E /* MainThread.h in Headers */,
     
    13761398                                E1A862D60D7F2B5C001EC6AA /* CollatorDefault.cpp in Sources */,
    13771399                                E178636D0D9BEEC300D74E75 /* InitializeThreading.cpp in Sources */,
     1400                                95AB83420DA4322500BC83F3 /* Profiler.cpp in Sources */,
     1401                                95AB83560DA43C3000BC83F3 /* FunctionCallProfile.cpp in Sources */,
    13781402                                06D358B30DAADAA4003B174E /* MainThread.cpp in Sources */,
    13791403                                06D358B40DAADAAA003B174E /* MainThreadMac.mm in Sources */,
Note: See TracChangeset for help on using the changeset viewer.