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/wtf/HashCountedSet.h

    r17127 r32760  
    2626#include "Assertions.h"
    2727#include "HashMap.h"
     28#include "Vector.h"
    2829
    2930namespace WTF {
     
    171172        m_impl.clear();
    172173    }
     174   
     175    template<typename Value, typename HashFunctions, typename Traits, typename VectorType>
     176    inline void copyToVector(const HashCountedSet<Value, HashFunctions, Traits>& collection, VectorType& vector)
     177    {
     178        typedef typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator iterator;
     179       
     180        vector.resize(collection.size());
     181       
     182        iterator it = collection.begin();
     183        iterator end = collection.end();
     184        for (unsigned i = 0; it != end; ++it, ++i)
     185            vector[i] = *it;
     186    }
     187
     188    template<typename Value, typename HashFunctions, typename Traits>
     189    inline void copyToVector(const HashCountedSet<Value, HashFunctions, Traits>& collection, Vector<Value>& vector)
     190    {
     191        typedef typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator iterator;
     192       
     193        vector.resize(collection.size());
     194       
     195        iterator it = collection.begin();
     196        iterator end = collection.end();
     197        for (unsigned i = 0; it != end; ++it, ++i)
     198            vector[i] = (*it).first;
     199    }
     200
    173201
    174202} // namespace khtml
Note: See TracChangeset for help on using the changeset viewer.