Commit 2998eb30 authored by kmccullough@apple.com's avatar kmccullough@apple.com

2008-05-19 Kevin McCullough <kmccullough@apple.com>

        Reviewed by Tim.

        <rdar://problem/5770054> JavaScript profiler (10928)
        - Implement sorting by function name.

        * JavaScriptCore.exp:
        * profiler/Profile.h:
        (KJS::Profile::sortFileNameDescending):
        (KJS::Profile::sortFileNameAscending):
        * profiler/ProfileNode.cpp:
        (KJS::fileNameDescendingComparator):
        (KJS::ProfileNode::sortFileNameDescending):
        (KJS::fileNameAscendingComparator):
        (KJS::ProfileNode::sortFileNameAscending):
        * profiler/ProfileNode.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33596 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f0bae5cd
2008-05-19 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/5770054> JavaScript profiler (10928)
- Implement sorting by function name.
* JavaScriptCore.exp:
* profiler/Profile.h:
(KJS::Profile::sortFileNameDescending):
(KJS::Profile::sortFileNameAscending):
* profiler/ProfileNode.cpp:
(KJS::fileNameDescendingComparator):
(KJS::ProfileNode::sortFileNameDescending):
(KJS::fileNameAscendingComparator):
(KJS::ProfileNode::sortFileNameAscending):
* profiler/ProfileNode.h:
2008-05-19 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
......
......@@ -94,6 +94,8 @@ __ZN3KJS11JSImmediate8toStringEPKNS_7JSValueE
__ZN3KJS11ProfileNode18sortCallsAscendingEv
__ZN3KJS11ProfileNode19sortCallsDescendingEv
__ZN3KJS11ProfileNode21sortSelfTimeAscendingEv
__ZN3KJS11ProfileNode21sortFileNameAscendingEv
__ZN3KJS11ProfileNode22sortFileNameDescendingEv
__ZN3KJS11ProfileNode22sortSelfTimeDescendingEv
__ZN3KJS11ProfileNode22sortTotalTimeAscendingEv
__ZN3KJS11ProfileNode23sortTotalTimeDescendingEv
......
......@@ -55,6 +55,8 @@ namespace KJS {
void sortSelfTimeAscending() { m_callTree->sortSelfTimeAscending(); }
void sortCallsDescending() { m_callTree->sortCallsDescending(); }
void sortCallsAscending() { m_callTree->sortCallsAscending(); }
void sortFileNameDescending() { m_callTree->sortFileNameDescending(); }
void sortFileNameAscending() { m_callTree->sortFileNameAscending(); }
void printDataInspectorStyle() const;
void printDataSampleStyle() const;
......
......@@ -190,6 +190,32 @@ void ProfileNode::sortCallsAscending()
(*currentChild)->sortCallsAscending();
}
static inline bool fileNameDescendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b)
{
return compare(a->functionName(), b->functionName()) == 1 ? true : false ;
}
void ProfileNode::sortFileNameDescending()
{
std::sort(m_children.begin(), m_children.end(), fileNameDescendingComparator);
for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild)
(*currentChild)->sortFileNameDescending();
}
static inline bool fileNameAscendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b)
{
return compare(a->functionName(), b->functionName()) == -1 ? true : false ;
}
void ProfileNode::sortFileNameAscending()
{
std::sort(m_children.begin(), m_children.end(), fileNameAscendingComparator);
for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild)
(*currentChild)->sortFileNameAscending();
}
void ProfileNode::endAndRecordCall()
{
m_totalTime += getCurrentUTCTime() - m_startTime;
......
......@@ -69,6 +69,8 @@ namespace KJS {
void sortSelfTimeAscending();
void sortCallsDescending();
void sortCallsAscending();
void sortFileNameDescending();
void sortFileNameAscending();
void endAndRecordCall();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment