Commit 6fc919da authored by kmccullough@apple.com's avatar kmccullough@apple.com

JavaScriptCore:

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

        Reviewed by Adam.

        <rdar://problem/5770054> JavaScript profiler (10928)
        - Pass the exec state to profiler when calling startProfiling so that if
        profiling is started within an execution context that location is
        recorded correctly.

        * JavaScriptCore.exp:
        * profiler/ProfileNode.cpp:
        (KJS::ProfileNode::printDataInspectorStyle): Dump more info for debugging
        purposes.
        * profiler/Profiler.cpp:
        (KJS::Profiler::startProfiling):
        * profiler/Profiler.h:

WebCore:

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

        Reviewed by Adam.

        <rdar://problem/5770054> JavaScript profiler (10928)
        - Send the executing context to the profiler so it can attribute time
        correctly to parent functions when calling profile() and profileEnd()
        while nested.

        * page/Console.cpp:
        (WebCore::Console::profile):
        (WebCore::Console::profileEnd):
        * page/Console.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 981039f2
2008-05-19 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
<rdar://problem/5770054> JavaScript profiler (10928)
- Pass the exec state to profiler when calling startProfiling so that if
profiling is started within an execution context that location is
recorded correctly.
* JavaScriptCore.exp:
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::printDataInspectorStyle): Dump more info for debugging
purposes.
* profiler/Profiler.cpp:
(KJS::Profiler::startProfiling):
* profiler/Profiler.h:
2008-05-19 Kevin McCullough <kmccullough@apple.com>
Rubberstamped by Geoff.
......
......@@ -196,7 +196,7 @@ __ZN3KJS8JSObject9constructEPNS_9ExecStateERKNS_4ListERKNS_10IdentifierERKNS_7US
__ZN3KJS8JSObject9putDirectERKNS_10IdentifierEPNS_7JSValueEi
__ZN3KJS8JSObject9putDirectERKNS_10IdentifierEii
__ZN3KJS8Profiler13stopProfilingEv
__ZN3KJS8Profiler14startProfilingEjRKNS_7UStringE
__ZN3KJS8Profiler14startProfilingEPNS_9ExecStateEjRKNS_7UStringE
__ZN3KJS8Profiler8profilerEv
__ZN3KJS8jsStringEPKc
__ZN3KJS8jsStringERKNS_7UStringE
......
......@@ -201,13 +201,10 @@ void ProfileNode::endAndRecordCall()
void ProfileNode::printDataInspectorStyle(int indentLevel) const
{
// Print function names
if (indentLevel) {
for (int i = 0; i < indentLevel; ++i)
printf(" ");
for (int i = 0; i < indentLevel; ++i)
printf(" ");
printf("%d SelfTime %.3fms %.3f%% TotalTime %.3fms%.3f%% FunctionName %s\n", m_numberOfCalls, m_selfTime, selfPercent(), m_totalTime, totalPercent(), m_functionName.UTF8String().c_str());
} else
printf("%s\n", m_functionName.UTF8String().c_str());
printf("%d SelfTime %.3fms/%.3f%% TotalTime %.3fms/%.3f%% FunctionName %s\n", m_numberOfCalls, m_selfTime, selfPercent(), m_totalTime, totalPercent(), m_functionName.UTF8String().c_str());
++indentLevel;
......
......@@ -54,7 +54,7 @@ Profiler* Profiler::profiler()
return sharedProfiler;
}
void Profiler::startProfiling(unsigned pageGroupIdentifier, const UString& title)
void Profiler::startProfiling(ExecState* exec, unsigned pageGroupIdentifier, const UString& title)
{
if (m_profiling)
return;
......@@ -63,6 +63,10 @@ void Profiler::startProfiling(unsigned pageGroupIdentifier, const UString& title
m_currentProfile = Profile::create(title);
m_profiling = true;
Vector<UString> callStackNames;
getStackNames(callStackNames, exec);
m_currentProfile->willExecute(callStackNames);
}
void Profiler::stopProfiling()
......
......@@ -43,7 +43,7 @@ namespace KJS {
static Profiler* profiler();
static void debugLog(UString);
void startProfiling(unsigned pageGroupIdentifier, const UString&);
void startProfiling(ExecState*, unsigned pageGroupIdentifier, const UString&);
void stopProfiling();
void willExecute(ExecState*, JSObject* calledFunction);
......
2008-05-19 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
<rdar://problem/5770054> JavaScript profiler (10928)
- Send the executing context to the profiler so it can attribute time
correctly to parent functions when calling profile() and profileEnd()
while nested.
* page/Console.cpp:
(WebCore::Console::profile):
(WebCore::Console::profileEnd):
* page/Console.h:
2008-05-19 Alp Toker <alp@nuanti.com>
Reviewed by Anders and Beth.
......@@ -129,23 +129,18 @@ void Console::log(ExecState* exec, const List& arguments)
page->inspectorController()->addMessageToConsole(JSMessageSource, LogMessageLevel, exec, arguments, 0, url.string());
}
void Console::profile(const String& title) const
void Console::profile(ExecState* exec, const String& title) const
{
// FIXME: Figure out something to do with the title passed in so that it can
// be displayed by the inspector.
Page* page = m_frame->page();
if (!page)
return;
Profiler::profiler()->startProfiling(page->group().identifier(), title);
Profiler::profiler()->startProfiling(exec, page->group().identifier(), title);
}
void Console::profileEnd() const
{
Profiler::profiler()->stopProfiling();
// FIXME: We need to hook into the WebInspector here so that it can process over the data
// that is in the profiler and display it in some new cool way, as opposed to just printing
// it or dumping it to the console.
}
void Console::warn(ExecState* exec, const List& arguments)
......
......@@ -70,7 +70,7 @@ namespace WebCore {
void info(KJS::ExecState*, const KJS::List& arguments);
void log(KJS::ExecState*, const KJS::List& arguments);
void warn(KJS::ExecState*, const KJS::List& arguments);
void profile(const String& title) const;
void profile(KJS::ExecState*, const String& title) const;
void profileEnd() const;
private:
......
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