Ignore:
Timestamp:
May 1, 2008, 9:32:32 AM (17 years ago)
Author:
[email protected]
Message:

2008-05-01 Kevin McCullough <[email protected]>

Reviewed by Darin.

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

  • Fix "sample" output so that it can be imported into Instruments
  • Also keep track of number of times a function is profiled.
  • JavaScriptCore.xcodeproj/project.pbxproj: Add StrHash.h which needed to be pulled out of identifier.cpp so that it could be used by the profiler and identifiers.
  • kjs/identifier.cpp: Ditto.
  • profiler/FunctionCallProfile.cpp: (KJS::FunctionCallProfile::printDataInspectorStyle): Inspector style printing should show microseconds. (KJS::FunctionCallProfile::printDataSampleStyle): Sample style printing now counts the number of times a function is in the stack tree and does not print microseconds since that does not make sense for a sampler.
  • profiler/FunctionCallProfile.h: Keep track of number of times a function is profiled. (KJS::FunctionCallProfile::numberOfCalls):
  • profiler/Profiler.cpp: (KJS::functionNameCountPairComparator): Comparator for sort function in printDataSampleStyle. (KJS::Profiler::printDataSampleStyle): Print the number of times that a function is listed in the stack tree in order of most times listed.
  • wtf/HashCountedSet.h: Added copyToVector since it didn't exist and is a more standard way to copy a HashSet to a Vector. I added on variant that takes a pair as the Vector's type and so the HashCountedSet simply fills in that pair with its internal pair, and another variant that takes a Vector of the type of the HashCountedSet and only fills in the Vector with the first element of the pair. (WTF::copyToVector):
  • wtf/StrHash.h: Added. (WTF::):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/profiler/FunctionCallProfile.h

    r32693 r32760  
    3232#include <kjs/ustring.h>
    3333#include <wtf/Deque.h>
     34#include <wtf/StrHash.h>
    3435
    3536namespace KJS {
     
    3839
    3940    typedef Deque<FunctionCallProfile*>::const_iterator StackIterator;
     41    typedef HashCountedSet<UString::Rep*> FunctionCallHashCount;
    4042
    4143    class FunctionCallProfile {
     
    5456        UString functionName() const { return m_functionName; }
    5557        double milliSecs() const { return m_timeSum; }
     58        unsigned numberOfCalls() const { return m_numberOfCalls; }
    5659
    5760        void printDataInspectorStyle(int indentLevel) const;
    58         double printDataSampleStyle(int indentLevel) const;
     61        double printDataSampleStyle(int indentLevel, FunctionCallHashCount&) const;
    5962
    6063    private:
Note: See TracChangeset for help on using the changeset viewer.