Changeset 173199 in webkit for trunk/Source/JavaScriptCore/profiler/Profile.cpp
- Timestamp:
- Sep 2, 2014, 9:58:55 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/profiler/Profile.cpp
r173120 r173199 40 40 : m_title(title) 41 41 , m_uid(uid) 42 , m_idleTime(0)43 42 { 44 43 // FIXME: When multi-threading is supported this will be a vector and calls 45 44 // into the profiler will need to know which thread it is executing on. 46 m_ head = ProfileNode::create(0, CallIdentifier(ASCIILiteral("Thread_1"), String(), 0, 0), 0, 0);45 m_rootNode = ProfileNode::create(nullptr, CallIdentifier(ASCIILiteral("Thread_1"), String(), 0, 0), nullptr); 47 46 } 48 47 … … 51 50 } 52 51 53 void Profile::forEach(void (ProfileNode::*function)()) 52 #ifndef NDEBUG 53 void Profile::debugPrint() 54 54 { 55 ProfileNode* currentNode = m_head->firstChild();56 for (ProfileNode* nextNode = currentNode; nextNode; nextNode = nextNode->firstChild())57 currentNode = nextNode;55 CalculateProfileSubtreeDataFunctor functor; 56 m_rootNode->forEachNodePostorder(functor); 57 ProfileNode::ProfileSubtreeData data = functor.returnValue(); 58 58 59 if (!currentNode)60 currentNode = m_head.get();61 62 ProfileNode* endNode = m_head->traverseNextNodePostOrder();63 while (currentNode && currentNode != endNode) {64 (currentNode->*function)();65 currentNode = currentNode->traverseNextNodePostOrder();66 }67 }68 69 #ifndef NDEBUG70 void Profile::debugPrintData() const71 {72 59 dataLogF("Call graph:\n"); 73 m_ head->debugPrintData(0);60 m_rootNode->debugPrintRecursively(0, data); 74 61 } 75 62 … … 81 68 } 82 69 83 void Profile::debugPrint DataSampleStyle() const70 void Profile::debugPrintSampleStyle() 84 71 { 85 72 typedef Vector<NameCountPair> NameCountPairVector; 86 73 74 CalculateProfileSubtreeDataFunctor functor; 75 m_rootNode->forEachNodePostorder(functor); 76 ProfileNode::ProfileSubtreeData data = functor.returnValue(); 77 87 78 FunctionCallHashCount countedFunctions; 88 79 dataLogF("Call graph:\n"); 89 m_ head->debugPrintDataSampleStyle(0, countedFunctions);80 m_rootNode->debugPrintSampleStyleRecursively(0, countedFunctions, data); 90 81 91 82 dataLogF("\nTotal number in stack:\n");
Note:
See TracChangeset
for help on using the changeset viewer.