Commit 6101f799 authored by kmccullough@apple.com's avatar kmccullough@apple.com

JavaScriptCore:

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

        Reviewed by John.

        <rdar://problem/5770054> JavaScript profiler (10928)
        - Have each FunctionCallProfile be able to return it's total and self time.

        * JavaScriptCore.exp:
        * profiler/FunctionCallProfile.cpp:
        (KJS::FunctionCallProfile::selfTime):
        * profiler/FunctionCallProfile.h:
        (KJS::FunctionCallProfile::totalTime):

WebCore:

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

        Reviewed by John.

        -<rdar://problem/5770054> JavaScript profiler (10928)
        Use the FunctionCallProfile's new total and self time functions.

        * page/JavaScriptFunctionCallProfile.cpp:
        (WebCore::getTotalTime):
        (WebCore::getSelfTime):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33464 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d4b6f63d
2008-05-14 Kevin McCullough <kmccullough@apple.com>
Reviewed by John.
<rdar://problem/5770054> JavaScript profiler (10928)
- Have each FunctionCallProfile be able to return it's total and self time.
* JavaScriptCore.exp:
* profiler/FunctionCallProfile.cpp:
(KJS::FunctionCallProfile::selfTime):
* profiler/FunctionCallProfile.h:
(KJS::FunctionCallProfile::totalTime):
2008-05-14 Alexey Proskuryakov <ap@webkit.org> 2008-05-14 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin. Reviewed by Darin.
......
...@@ -240,6 +240,7 @@ __ZNK3KJS14JSGlobalObject14isDynamicScopeEv ...@@ -240,6 +240,7 @@ __ZNK3KJS14JSGlobalObject14isDynamicScopeEv
__ZNK3KJS14JSGlobalObject14toGlobalObjectEPNS_9ExecStateE __ZNK3KJS14JSGlobalObject14toGlobalObjectEPNS_9ExecStateE
__ZNK3KJS16JSVariableObject16isVariableObjectEv __ZNK3KJS16JSVariableObject16isVariableObjectEv
__ZNK3KJS16JSVariableObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj __ZNK3KJS16JSVariableObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj
__ZNK3KJS19FunctionCallProfile8selfTimeEv
__ZNK3KJS19InternalFunctionImp14implementsCallEv __ZNK3KJS19InternalFunctionImp14implementsCallEv
__ZNK3KJS19InternalFunctionImp21implementsHasInstanceEv __ZNK3KJS19InternalFunctionImp21implementsHasInstanceEv
__ZNK3KJS4List8getSliceEiRS0_ __ZNK3KJS4List8getSliceEiRS0_
......
...@@ -98,6 +98,18 @@ void FunctionCallProfile::stopProfiling() ...@@ -98,6 +98,18 @@ void FunctionCallProfile::stopProfiling()
(*it)->stopProfiling(); (*it)->stopProfiling();
} }
double FunctionCallProfile::selfTime() const
{
double sumChildrenTime = 0.0;
for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild)
sumChildrenTime += (*currentChild)->totalTime();
ASSERT(sumChildrenTime <= m_timeSum);
return m_timeSum - sumChildrenTime;
}
void FunctionCallProfile::printDataInspectorStyle(int indentLevel) const void FunctionCallProfile::printDataInspectorStyle(int indentLevel) const
{ {
// Print function names // Print function names
......
...@@ -55,7 +55,8 @@ namespace KJS { ...@@ -55,7 +55,8 @@ namespace KJS {
void stopProfiling(); void stopProfiling();
UString functionName() const { return m_functionName; } UString functionName() const { return m_functionName; }
double milliSecs() const { return m_timeSum; } double totalTime() const { return m_timeSum; }
double selfTime() const;
unsigned numberOfCalls() const { return m_numberOfCalls; } unsigned numberOfCalls() const { return m_numberOfCalls; }
const Deque<RefPtr<FunctionCallProfile> >& children() { return m_children; } const Deque<RefPtr<FunctionCallProfile> >& children() { return m_children; }
......
2008-05-14 Kevin McCullough <kmccullough@apple.com>
Reviewed by John.
-<rdar://problem/5770054> JavaScript profiler (10928)
Use the FunctionCallProfile's new total and self time functions.
* page/JavaScriptFunctionCallProfile.cpp:
(WebCore::getTotalTime):
(WebCore::getSelfTime):
2008-05-14 Anders Carlsson <andersca@apple.com> 2008-05-14 Anders Carlsson <andersca@apple.com>
Reviewed by Adam. Reviewed by Adam.
...@@ -70,7 +70,7 @@ static JSValueRef getTotalTime(JSContextRef ctx, JSObjectRef thisObject, JSStrin ...@@ -70,7 +70,7 @@ static JSValueRef getTotalTime(JSContextRef ctx, JSObjectRef thisObject, JSStrin
return JSValueMakeUndefined(ctx); return JSValueMakeUndefined(ctx);
FunctionCallProfile* functionCallProfile = static_cast<FunctionCallProfile*>(JSObjectGetPrivate(thisObject)); FunctionCallProfile* functionCallProfile = static_cast<FunctionCallProfile*>(JSObjectGetPrivate(thisObject));
return JSValueMakeNumber(ctx, functionCallProfile->milliSecs()); return JSValueMakeNumber(ctx, functionCallProfile->totalTime());
} }
static JSValueRef getSelfTime(JSContextRef ctx, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) static JSValueRef getSelfTime(JSContextRef ctx, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
...@@ -81,7 +81,7 @@ static JSValueRef getSelfTime(JSContextRef ctx, JSObjectRef thisObject, JSString ...@@ -81,7 +81,7 @@ static JSValueRef getSelfTime(JSContextRef ctx, JSObjectRef thisObject, JSString
return JSValueMakeUndefined(ctx); return JSValueMakeUndefined(ctx);
FunctionCallProfile* functionCallProfile = static_cast<FunctionCallProfile*>(JSObjectGetPrivate(thisObject)); FunctionCallProfile* functionCallProfile = static_cast<FunctionCallProfile*>(JSObjectGetPrivate(thisObject));
return JSValueMakeNumber(ctx, functionCallProfile->milliSecs()); return JSValueMakeNumber(ctx, functionCallProfile->selfTime());
} }
static JSValueRef getNumberOfCalls(JSContextRef ctx, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) static JSValueRef getNumberOfCalls(JSContextRef ctx, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
......
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