Commit 77b5abfc authored by kmccullough@apple.com's avatar kmccullough@apple.com

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

        Reviewed by Darin.

        <rdar://problem/5950796> JSProfiler: dump functions are in the code
        Removed dump and logging functions from the Release version of the code
        and renamed them to be obviously for debugging only.

        * JavaScriptCore.exp:
        * profiler/Profile.cpp:
        (KJS::Profile::debugPrintData):
        (KJS::Profile::debugPrintDataSampleStyle):
        * profiler/Profile.h:
        * profiler/ProfileNode.cpp:
        (KJS::ProfileNode::debugPrintData):
        (KJS::ProfileNode::debugPrintDataSampleStyle):
        * profiler/ProfileNode.h:
        * profiler/Profiler.cpp:
        * profiler/Profiler.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33947 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d1b1b1fe
2008-05-20 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin.
<rdar://problem/5950796> JSProfiler: dump functions are in the code
Removed dump and logging functions from the Release version of the code
and renamed them to be obviously for debugging only.
* JavaScriptCore.exp:
* profiler/Profile.cpp:
(KJS::Profile::debugPrintData):
(KJS::Profile::debugPrintDataSampleStyle):
* profiler/Profile.h:
* profiler/ProfileNode.cpp:
(KJS::ProfileNode::debugPrintData):
(KJS::ProfileNode::debugPrintDataSampleStyle):
* profiler/ProfileNode.h:
* profiler/Profiler.cpp:
* profiler/Profiler.h:
2008-05-20 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
......
......@@ -260,7 +260,6 @@ __ZNK3KJS6JSCell9getNumberEv
__ZNK3KJS6JSCell9getStringERNS_7UStringE
__ZNK3KJS6JSCell9getStringEv
__ZNK3KJS6JSCell9getUInt32ERj
__ZNK3KJS7Profile23printDataInspectorStyleEv
__ZNK3KJS7JSValue15toInt32SlowCaseEPNS_9ExecStateERb
__ZNK3KJS7JSValue16toUInt32SlowCaseEPNS_9ExecStateERb
__ZNK3KJS7JSValue7toFloatEPNS_9ExecStateE
......
......@@ -72,10 +72,11 @@ void Profile::didExecute(const Vector<CallIdentifier>& callIdentifiers)
m_callTree->didExecute(callIdentifiers, callIdentifiers.size() - 1);
}
void Profile::printDataInspectorStyle() const
#ifndef NDEBUG
void Profile::debugPrintData() const
{
printf("Call graph:\n");
m_callTree->printDataInspectorStyle(0);
m_callTree->debugPrintData(0);
}
typedef pair<UString::Rep*, unsigned> NameCountPair;
......@@ -85,13 +86,13 @@ static inline bool functionNameCountPairComparator(const NameCountPair& a, const
return a.second > b.second;
}
void Profile::printDataSampleStyle() const
void Profile::debugPrintDataSampleStyle() const
{
typedef Vector<NameCountPair> NameCountPairVector;
FunctionCallHashCount countedFunctions;
printf("Call graph:\n");
m_callTree->printDataSampleStyle(0, countedFunctions);
m_callTree->debugPrintDataSampleStyle(0, countedFunctions);
printf("\nTotal number in stack:\n");
NameCountPairVector sortedFunctions(countedFunctions.size());
......@@ -103,5 +104,6 @@ void Profile::printDataSampleStyle() const
printf("\nSort by top of stack, same collapsed (when >= 5):\n");
}
#endif
} // namespace KJS
......@@ -57,9 +57,10 @@ namespace KJS {
void sortCallsAscending() { m_callTree->sortCallsAscending(); }
void sortFunctionNameDescending() { m_callTree->sortFunctionNameDescending(); }
void sortFunctionNameAscending() { m_callTree->sortFunctionNameAscending(); }
void printDataInspectorStyle() const;
void printDataSampleStyle() const;
#ifndef NDEBUG
void debugPrintData() const;
void debugPrintDataSampleStyle() const;
#endif
private:
Profile(const UString& title);
......
......@@ -249,8 +249,8 @@ void ProfileNode::calculatePercentages(double totalProfileTime)
m_selfPercent = (m_selfTime / totalProfileTime) * 100.0;
}
void ProfileNode::printDataInspectorStyle(int indentLevel) const
#ifndef NDEBUG
void ProfileNode::debugPrintData(int indentLevel) const
{
// Print function names
for (int i = 0; i < indentLevel; ++i)
......@@ -262,11 +262,11 @@ void ProfileNode::printDataInspectorStyle(int indentLevel) const
// Print children's names and information
for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild)
(*currentChild)->printDataInspectorStyle(indentLevel);
(*currentChild)->debugPrintData(indentLevel);
}
// print the profiled data in a format that matches the tool sample's output.
double ProfileNode::printDataSampleStyle(int indentLevel, FunctionCallHashCount& countedFunctions) const
double ProfileNode::debugPrintDataSampleStyle(int indentLevel, FunctionCallHashCount& countedFunctions) const
{
printf(" ");
......@@ -288,7 +288,7 @@ double ProfileNode::printDataSampleStyle(int indentLevel, FunctionCallHashCount&
// Print children's names and information
double sumOfChildrensCount = 0.0;
for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild)
sumOfChildrensCount += (*currentChild)->printDataSampleStyle(indentLevel, countedFunctions);
sumOfChildrensCount += (*currentChild)->debugPrintDataSampleStyle(indentLevel, countedFunctions);
sumOfChildrensCount *= 1000; //
// Print remainder of samples to match sample's output
......@@ -302,5 +302,6 @@ double ProfileNode::printDataSampleStyle(int indentLevel, FunctionCallHashCount&
return m_totalTime;
}
#endif
} // namespace KJS
......@@ -93,10 +93,10 @@ namespace KJS {
void endAndRecordCall();
void calculatePercentages(double totalProfileTime);
void printDataInspectorStyle(int indentLevel) const;
double printDataSampleStyle(int indentLevel, FunctionCallHashCount&) const;
#ifndef NDEBUG
void debugPrintData(int indentLevel) const;
double debugPrintDataSampleStyle(int indentLevel, FunctionCallHashCount&) const;
#endif
private:
ProfileNode(const CallIdentifier& callIdentifier);
......
......@@ -174,9 +174,4 @@ void getCallIdentifierFromFunctionImp(FunctionImp* functionImp, Vector<CallIdent
callIdentifiers.append(CallIdentifier(name, functionImp->body->sourceURL(), functionImp->body->lineNo()) );
}
void Profiler::debugLog(UString message)
{
printf("Profiler Log: %s\n", message.UTF8String().c_str());
}
} // namespace KJS
......@@ -41,7 +41,6 @@ namespace KJS {
class Profiler {
public:
static Profiler* profiler();
static void debugLog(UString);
void startProfiling(ExecState*, unsigned pageGroupIdentifier, const UString&);
void stopProfiling();
......
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