]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - profiler/Profile.cpp
JavaScriptCore-1097.13.tar.gz
[apple/javascriptcore.git] / profiler / Profile.cpp
index 72e6d21a0b0271e381755a537f24b6f569eeef11..49d6de97a98ab0c53feea65b38969fd301133997 100644 (file)
 #include "Profile.h"
 
 #include "ProfileNode.h"
-#include "TreeProfile.h"
 #include <stdio.h>
+#include <wtf/DataLog.h>
 
 namespace JSC {
 
 PassRefPtr<Profile> Profile::create(const UString& title, unsigned uid)
 {
-    return TreeProfile::create(title, uid);
+    return adoptRef(new Profile(title, uid));
 }
 
 Profile::Profile(const UString& title, unsigned uid)
@@ -43,7 +43,7 @@ Profile::Profile(const UString& title, unsigned uid)
 {
     // FIXME: When multi-threading is supported this will be a vector and calls
     // into the profiler will need to know which thread it is executing on.
-    m_head = ProfileNode::create(CallIdentifier("Thread_1", 0, 0), 0, 0);
+    m_head = ProfileNode::create(0, CallIdentifier("Thread_1", UString(), 0), 0, 0);
 }
 
 Profile::~Profile()
@@ -103,11 +103,11 @@ void Profile::restoreAll()
 #ifndef NDEBUG
 void Profile::debugPrintData() const
 {
-    printf("Call graph:\n");
+    dataLog("Call graph:\n");
     m_head->debugPrintData(0);
 }
 
-typedef pair<UString::Rep*, unsigned> NameCountPair;
+typedef pair<StringImpl*, unsigned> NameCountPair;
 
 static inline bool functionNameCountPairComparator(const NameCountPair& a, const NameCountPair& b)
 {
@@ -119,18 +119,18 @@ void Profile::debugPrintDataSampleStyle() const
     typedef Vector<NameCountPair> NameCountPairVector;
 
     FunctionCallHashCount countedFunctions;
-    printf("Call graph:\n");
+    dataLog("Call graph:\n");
     m_head->debugPrintDataSampleStyle(0, countedFunctions);
 
-    printf("\nTotal number in stack:\n");
+    dataLog("\nTotal number in stack:\n");
     NameCountPairVector sortedFunctions(countedFunctions.size());
     copyToVector(countedFunctions, sortedFunctions);
 
     std::sort(sortedFunctions.begin(), sortedFunctions.end(), functionNameCountPairComparator);
     for (NameCountPairVector::iterator it = sortedFunctions.begin(); it != sortedFunctions.end(); ++it)
-        printf("        %-12d%s\n", (*it).second, UString((*it).first).UTF8String().c_str());
+        dataLog("        %-12d%s\n", (*it).second, UString((*it).first).utf8().data());
 
-    printf("\nSort by top of stack, same collapsed (when >= 5):\n");
+    dataLog("\nSort by top of stack, same collapsed (when >= 5):\n");
 }
 #endif