Commit 0be4b5e5 authored by kmccullough@apple.com's avatar kmccullough@apple.com

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

        Reviewed by Tim.

        <rdar://problem/5770054> JavaScript profiler (10928)
        Removed only profiler-internal use of currentProfile since that concept
        is changing.

        * profiler/Profile.h: Now stopProfiling takes a time and bool as
        arguments.  The time is used to calculate %s from and the bool tells
        if this node is the head node and should be the one calculating the time.
        (KJS::Profile::stopProfiling):
        * profiler/ProfileNode.cpp: Ditto.
        (KJS::ProfileNode::stopProfiling):
        * profiler/ProfileNode.h: Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33943 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2efe1b75
2008-05-20 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
<rdar://problem/5770054> JavaScript profiler (10928)
Removed only profiler-internal use of currentProfile since that concept
is changing.
* profiler/Profile.h: Now stopProfiling takes a time and bool as
arguments. The time is used to calculate %s from and the bool tells
if this node is the head node and should be the one calculating the time.
(KJS::Profile::stopProfiling):
* profiler/ProfileNode.cpp: Ditto.
(KJS::ProfileNode::stopProfiling):
* profiler/ProfileNode.h: Ditto.
2008-05-20 Kevin McCullough <kmccullough@apple.com>
Accidentally turned on the profiler.
......
......@@ -43,7 +43,7 @@ namespace KJS {
void willExecute(const Vector<CallIdentifier>& CallIdentifier);
void didExecute(const Vector<CallIdentifier>& CallIdentifier);
void stopProfiling() { m_callTree->stopProfiling(); };
void stopProfiling() { m_callTree->stopProfiling(0, true); };
const UString& title() const { return m_title; };
ProfileNode* callTree() const { return m_callTree.get(); };
......
......@@ -92,25 +92,28 @@ ProfileNode* ProfileNode::findChild(const CallIdentifier& functionName)
return 0;
}
void ProfileNode::stopProfiling()
void ProfileNode::stopProfiling(double totalProfileTime, bool headProfileNode)
{
if (m_startTime)
endAndRecordCall();
ASSERT(m_selfTime == 0.0);
if (headProfileNode)
totalProfileTime = m_totalTime;
// Calculate Self time and the percentages once we stop profiling.
StackIterator endOfChildren = m_children.end();
for (StackIterator currentChild = m_children.begin(); currentChild != endOfChildren; ++currentChild) {
(*currentChild)->stopProfiling();
(*currentChild)->stopProfiling(totalProfileTime);
m_selfTime += (*currentChild)->totalTime();
}
ASSERT(m_selfTime <= m_totalTime);
m_selfTime = m_totalTime - m_selfTime;
m_totalPercent = (m_totalTime / Profiler::profiler()->currentProfile()->totalTime()) * 100.0;
m_selfPercent = (selfTime() / Profiler::profiler()->currentProfile()->totalTime()) * 100.0;
m_totalPercent = (m_totalTime / totalProfileTime) * 100.0;
m_selfPercent = (m_selfTime / totalProfileTime) * 100.0;
}
#pragma mark Sorting methods
......
......@@ -63,7 +63,7 @@ namespace KJS {
void addChild(PassRefPtr<ProfileNode> prpChild);
ProfileNode* findChild(const CallIdentifier& functionName);
void stopProfiling();
void stopProfiling(double totalProfileTime, bool headProfileNode = false);
CallIdentifier callIdentifier() const { return m_callIdentifier; }
UString functionName() const { return m_callIdentifier.name; }
......
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