| 1 | /* |
| 2 | * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of |
| 14 | * its contributors may be used to endorse or promote products derived |
| 15 | * from this software without specific prior written permission. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
| 18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 20 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #include "config.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/config.h`/ |
| 30 | #include "ProfileNode.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/profiler/ProfileNode.h`/ |
| 31 | |
| 32 | #include "Profiler.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/profiler/Profiler.h`/ |
| 33 | #include <stdio.h> |
| 34 | #include <wtf/DateMath.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.h`/ |
| 35 | |
| 36 | #if OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(WINDOWS) |
| 37 | #include <windows.h> |
| 38 | #endif |
| 39 | |
| 40 | using namespace WTFcxx . . $ `<built-in>:467:9`!; |
| 41 | |
| 42 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 43 | |
| 44 | static double getCountcxx . . $ QTJSC/getCount(31fa7155c10fdd13).() |
| 45 | { |
| 46 | #if OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(WINDOWS) |
| 47 | static LARGE_INTEGER frequency = {0}; |
| 48 | if (!frequency.QuadPart) |
| 49 | QueryPerformanceFrequency(&frequency); |
| 50 | LARGE_INTEGER counter; |
| 51 | QueryPerformanceCounter(&counter); |
| 52 | return static_cast<double>(counter.QuadPart) / frequency.QuadPart; |
| 53 | #else |
| 54 | return currentTimeMScxx . . $ QTWTF/currentTimeMS(31fa7155c10fdd13).(); |
| 55 | #endif |
| 56 | } |
| 57 | |
| 58 | ProfileNodecxx . . $ QTJSC/ProfileNode#::ProfileNodecxx . . $ QTJSC/ProfileNode#ProfileNode(ccbbc6087b523190).(const CallIdentifiercxx . . $ QTJSC/CallIdentifier#& callIdentifier, ProfileNodecxx . . $ QTJSC/ProfileNode#* headNode, ProfileNodecxx . . $ QTJSC/ProfileNode#* parentNode) |
| 59 | : m_callIdentifier(callIdentifier) |
| 60 | , m_headcxx . . $ QTJSC/ProfileNode#m_head.(headNode) |
| 61 | , m_parentcxx . . $ QTJSC/ProfileNode#m_parent.(parentNode) |
| 62 | , m_nextSiblingcxx . . $ QTJSC/ProfileNode#m_nextSibling.(0) |
| 63 | , m_startTimecxx . . $ QTJSC/ProfileNode#m_startTime.(0.0) |
| 64 | , m_actualTotalTimecxx . . $ QTJSC/ProfileNode#m_actualTotalTime.(0.0) |
| 65 | , m_visibleTotalTimecxx . . $ QTJSC/ProfileNode#m_visibleTotalTime.(0.0) |
| 66 | , m_actualSelfTimecxx . . $ QTJSC/ProfileNode#m_actualSelfTime.(0.0) |
| 67 | , m_visibleSelfTimecxx . . $ QTJSC/ProfileNode#m_visibleSelfTime.(0.0) |
| 68 | , m_numberOfCallscxx . . $ QTJSC/ProfileNode#m_numberOfCalls.(0) |
| 69 | , m_visiblecxx . . $ QTJSC/ProfileNode#m_visible.(true) |
| 70 | { |
| 71 | startTimercxx . . $ QTJSC/ProfileNode#startTimer(49f6e7a06ebc5aa8).(); |
| 72 | } |
| 73 | |
| 74 | ProfileNodecxx . . $ QTJSC/ProfileNode#::ProfileNodecxx . . $ QTJSC/ProfileNode#ProfileNode(f41e2251b97b4da5).(ProfileNodecxx . . $ QTJSC/ProfileNode#* headNode, ProfileNodecxx . . $ QTJSC/ProfileNode#* nodeToCopy) |
| 75 | : m_callIdentifier(nodeToCopy->callIdentifier()) |
| 76 | , m_headcxx . . $ QTJSC/ProfileNode#m_head.(headNode) |
| 77 | , m_parentcxx . . $ QTJSC/ProfileNode#m_parent.(nodeToCopy->parentcxx . . $ QTJSC/ProfileNode#parent(52aa179bc17c0068).()) |
| 78 | , m_nextSiblingcxx . . $ QTJSC/ProfileNode#m_nextSibling.(0) |
| 79 | , m_startTimecxx . . $ QTJSC/ProfileNode#m_startTime.(0.0) |
| 80 | , m_actualTotalTimecxx . . $ QTJSC/ProfileNode#m_actualTotalTime.(nodeToCopy->actualTotalTimecxx . . $ QTJSC/ProfileNode#actualTotalTime(21b6c25e127938e2).()) |
| 81 | , m_visibleTotalTimecxx . . $ QTJSC/ProfileNode#m_visibleTotalTime.(nodeToCopy->totalTimecxx . . $ QTJSC/ProfileNode#totalTime(21b6c25e127938e2).()) |
| 82 | , m_actualSelfTimecxx . . $ QTJSC/ProfileNode#m_actualSelfTime.(nodeToCopy->actualSelfTimecxx . . $ QTJSC/ProfileNode#actualSelfTime(21b6c25e127938e2).()) |
| 83 | , m_visibleSelfTimecxx . . $ QTJSC/ProfileNode#m_visibleSelfTime.(nodeToCopy->selfTimecxx . . $ QTJSC/ProfileNode#selfTime(21b6c25e127938e2).()) |
| 84 | , m_numberOfCallscxx . . $ QTJSC/ProfileNode#m_numberOfCalls.(nodeToCopy->numberOfCallscxx . . $ QTJSC/ProfileNode#numberOfCalls(ddd8539a2fcdd4ce).()) |
| 85 | , m_visiblecxx . . $ QTJSC/ProfileNode#m_visible.(nodeToCopy->visiblecxx . . $ QTJSC/ProfileNode#visible(50ce9a9e25b4a850).()) |
| 86 | { |
| 87 | } |
| 88 | |
| 89 | ProfileNodecxx . . $ QTJSC/ProfileNode#* ProfileNodecxx . . $ QTJSC/ProfileNode#::willExecutecxx . . $ QTJSC/ProfileNode#willExecute(3c0f6fb234cb72cf).(const CallIdentifiercxx . . $ QTJSC/CallIdentifier#& callIdentifier) |
| 90 | { |
| 91 | for (StackIteratorcxx . . $ QTJSC/StackIterator# currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild) { |
| 92 | if ((*currentChild)->callIdentifier() ==cxx . . $ QTJSC/`operator==`(e9142ab59ce7dac8). callIdentifier) { |
| 93 | (*currentChild)->startTimer(); |
| 94 | return (*currentChild).get(); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | RefPtrcxx . . $ RefPtr#<ProfileNodecxx . . $ QTJSC/ProfileNode#> newChild = ProfileNode::create(callIdentifier, m_head ? m_head : this, this); // If this ProfileNode has no head it is the head. |
| 99 | if (m_children.size()) |
| 100 | m_children.last()->setNextSibling(newChild.get()); |
| 101 | m_children.append(newChild.release()); |
| 102 | return m_children.last().get(); |
| 103 | } |
| 104 | |
| 105 | ProfileNodecxx . . $ QTJSC/ProfileNode#* ProfileNodecxx . . $ QTJSC/ProfileNode#::didExecutecxx . . $ QTJSC/ProfileNode#didExecute(211c0f6137bfcd86).() |
| 106 | { |
| 107 | endAndRecordCallcxx . . $ QTJSC/ProfileNode#endAndRecordCall(49f6e7a06ebc5aa8).(); |
| 108 | return m_parentcxx . . $ QTJSC/ProfileNode#m_parent.; |
| 109 | } |
| 110 | |
| 111 | void ProfileNodecxx . . $ QTJSC/ProfileNode#::addChildcxx . . $ QTJSC/ProfileNode#addChild(aabf76a710b61cc5).(PassRefPtrcxx . . $ PassRefPtr#<ProfileNodecxx . . $ QTJSC/ProfileNode#> prpChild) |
| 112 | { |
| 113 | RefPtrcxx . . $ RefPtr#<ProfileNodecxx . . $ QTJSC/ProfileNode#> child = prpChild; |
| 114 | child->setParent(this); |
| 115 | if (m_children.size()) |
| 116 | m_children.last()->setNextSibling(child.get()); |
| 117 | m_children.append(child.release()); |
| 118 | } |
| 119 | |
| 120 | ProfileNodecxx . . $ QTJSC/ProfileNode#* ProfileNodecxx . . $ QTJSC/ProfileNode#::findChildcxx . . $ QTJSC/ProfileNode#findChild(b292eb65e9cb3653).(ProfileNodecxx . . $ QTJSC/ProfileNode#* node) const |
| 121 | { |
| 122 | if (!node) |
| 123 | return 0; |
| 124 | |
| 125 | for (size_t i = 0; i < m_children.size(); ++i) { |
| 126 | if (*node == m_children[i].get()) |
| 127 | return m_children[i].get(); |
| 128 | } |
| 129 | |
| 130 | return 0; |
| 131 | } |
| 132 | |
| 133 | void ProfileNodecxx . . $ QTJSC/ProfileNode#::removeChildcxx . . $ QTJSC/ProfileNode#removeChild(c2a0125b6ef73b36).(ProfileNodecxx . . $ QTJSC/ProfileNode#* node) |
| 134 | { |
| 135 | if (!node) |
| 136 | return; |
| 137 | |
| 138 | for (size_t i = 0; i < m_children.size(); ++i) { |
| 139 | if (*node == m_children[i].get()) { |
| 140 | m_children.remove(i); |
| 141 | break; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | resetChildrensSiblingscxx . . $ QTJSC/ProfileNode#resetChildrensSiblings(49f6e7a06ebc5aa8).(); |
| 146 | } |
| 147 | |
| 148 | void ProfileNodecxx . . $ QTJSC/ProfileNode#::insertNodecxx . . $ QTJSC/ProfileNode#insertNode(aabf76a710b61cc5).(PassRefPtrcxx . . $ PassRefPtr#<ProfileNodecxx . . $ QTJSC/ProfileNode#> prpNode) |
| 149 | { |
| 150 | RefPtrcxx . . $ RefPtr#<ProfileNodecxx . . $ QTJSC/ProfileNode#> node = prpNode; |
| 151 | |
| 152 | for (unsigned i = 0; i < m_children.size(); ++i) |
| 153 | node->addChild(m_children[i].release()); |
| 154 | |
| 155 | m_children.clear(); |
| 156 | m_children.append(node.release()); |
| 157 | } |
| 158 | |
| 159 | void ProfileNodecxx . . $ QTJSC/ProfileNode#::stopProfilingcxx . . $ QTJSC/ProfileNode#stopProfiling(49f6e7a06ebc5aa8).() |
| 160 | { |
| 161 | if (m_startTimecxx . . $ QTJSC/ProfileNode#m_startTime.) |
| 162 | endAndRecordCallcxx . . $ QTJSC/ProfileNode#endAndRecordCall(49f6e7a06ebc5aa8).(); |
| 163 | |
| 164 | m_visibleTotalTimecxx . . $ QTJSC/ProfileNode#m_visibleTotalTime. = m_actualTotalTimecxx . . $ QTJSC/ProfileNode#m_actualTotalTime.; |
| 165 | |
| 166 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(m_actualSelfTime == 0.0 && m_startTime == 0.0); |
| 167 | |
| 168 | // Because we iterate in post order all of our children have been stopped before us. |
| 169 | for (unsigned i = 0; i < m_children.size(); ++i) |
| 170 | m_actualSelfTime += m_children[i]->totalTime(); |
| 171 | |
| 172 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(m_actualSelfTime <= m_actualTotalTime); |
| 173 | m_actualSelfTimecxx . . $ QTJSC/ProfileNode#m_actualSelfTime. = m_actualTotalTimecxx . . $ QTJSC/ProfileNode#m_actualTotalTime. - m_actualSelfTimecxx . . $ QTJSC/ProfileNode#m_actualSelfTime.; |
| 174 | m_visibleSelfTimecxx . . $ QTJSC/ProfileNode#m_visibleSelfTime. = m_actualSelfTimecxx . . $ QTJSC/ProfileNode#m_actualSelfTime.; |
| 175 | } |
| 176 | |
| 177 | ProfileNodecxx . . $ QTJSC/ProfileNode#* ProfileNodecxx . . $ QTJSC/ProfileNode#::traverseNextNodePostOrdercxx . . $ QTJSC/ProfileNode#traverseNextNodePostOrder(52aa179bc17c0068).() const |
| 178 | { |
| 179 | ProfileNodecxx . . $ QTJSC/ProfileNode#* next = m_nextSiblingcxx . . $ QTJSC/ProfileNode#m_nextSibling.; |
| 180 | if (!next) |
| 181 | return m_parentcxx . . $ QTJSC/ProfileNode#m_parent.; |
| 182 | while (ProfileNodecxx . . $ QTJSC/ProfileNode#* firstChild = next->firstChildcxx . . $ QTJSC/ProfileNode#firstChild(52aa179bc17c0068).()) |
| 183 | next = firstChild; |
| 184 | return next; |
| 185 | } |
| 186 | |
| 187 | ProfileNodecxx . . $ QTJSC/ProfileNode#* ProfileNodecxx . . $ QTJSC/ProfileNode#::traverseNextNodePreOrdercxx . . $ QTJSC/ProfileNode#traverseNextNodePreOrder(1f0cbde4ba45d0b6).(bool processChildren) const |
| 188 | { |
| 189 | if (processChildren && m_children.size()) |
| 190 | return m_children[0].get(); |
| 191 | |
| 192 | if (m_nextSiblingcxx . . $ QTJSC/ProfileNode#m_nextSibling.) |
| 193 | return m_nextSiblingcxx . . $ QTJSC/ProfileNode#m_nextSibling.; |
| 194 | |
| 195 | ProfileNodecxx . . $ QTJSC/ProfileNode#* nextParent = m_parentcxx . . $ QTJSC/ProfileNode#m_parent.; |
| 196 | if (!nextParent) |
| 197 | return 0; |
| 198 | |
| 199 | ProfileNodecxx . . $ QTJSC/ProfileNode#* next; |
| 200 | for (next = m_parentcxx . . $ QTJSC/ProfileNode#m_parent.->nextSiblingcxx . . $ QTJSC/ProfileNode#nextSibling(52aa179bc17c0068).(); !next; next = nextParent->nextSiblingcxx . . $ QTJSC/ProfileNode#nextSibling(52aa179bc17c0068).()) { |
| 201 | nextParent = nextParent->parentcxx . . $ QTJSC/ProfileNode#parent(52aa179bc17c0068).(); |
| 202 | if (!nextParent) |
| 203 | return 0; |
| 204 | } |
| 205 | |
| 206 | return next; |
| 207 | } |
| 208 | |
| 209 | void ProfileNodecxx . . $ QTJSC/ProfileNode#::setTreeVisiblecxx . . $ QTJSC/ProfileNode#setTreeVisible(d50a14f335a65df5).(ProfileNodecxx . . $ QTJSC/ProfileNode#* node, bool visible) |
| 210 | { |
| 211 | ProfileNodecxx . . $ QTJSC/ProfileNode#* nodeParent = node->parentcxx . . $ QTJSC/ProfileNode#parent(52aa179bc17c0068).(); |
| 212 | ProfileNodecxx . . $ QTJSC/ProfileNode#* nodeSibling = node->nextSiblingcxx . . $ QTJSC/ProfileNode#nextSibling(52aa179bc17c0068).(); |
| 213 | node->setParentcxx . . $ QTJSC/ProfileNode#setParent(c2a0125b6ef73b36).(0); |
| 214 | node->setNextSiblingcxx . . $ QTJSC/ProfileNode#setNextSibling(c2a0125b6ef73b36).(0); |
| 215 | |
| 216 | for (ProfileNodecxx . . $ QTJSC/ProfileNode#* currentNode = node; currentNode; currentNode = currentNode->traverseNextNodePreOrdercxx . . $ QTJSC/ProfileNode#traverseNextNodePreOrder(1f0cbde4ba45d0b6).()) |
| 217 | currentNode->setVisiblecxx . . $ QTJSC/ProfileNode#setVisible(b45ddcbc8423892c).(visible); |
| 218 | |
| 219 | node->setParentcxx . . $ QTJSC/ProfileNode#setParent(c2a0125b6ef73b36).(nodeParent); |
| 220 | node->setNextSiblingcxx . . $ QTJSC/ProfileNode#setNextSibling(c2a0125b6ef73b36).(nodeSibling); |
| 221 | } |
| 222 | |
| 223 | void ProfileNodecxx . . $ QTJSC/ProfileNode#::calculateVisibleTotalTimecxx . . $ QTJSC/ProfileNode#calculateVisibleTotalTime(49f6e7a06ebc5aa8).() |
| 224 | { |
| 225 | double sumOfVisibleChildrensTime = 0.0; |
| 226 | |
| 227 | for (unsigned i = 0; i < m_children.size(); ++i) { |
| 228 | if (m_children[i]->visible()) |
| 229 | sumOfVisibleChildrensTime += m_children[i]->totalTime(); |
| 230 | } |
| 231 | |
| 232 | m_visibleTotalTimecxx . . $ QTJSC/ProfileNode#m_visibleTotalTime. = m_visibleSelfTimecxx . . $ QTJSC/ProfileNode#m_visibleSelfTime. + sumOfVisibleChildrensTime; |
| 233 | } |
| 234 | |
| 235 | bool ProfileNodecxx . . $ QTJSC/ProfileNode#::focuscxx . . $ QTJSC/ProfileNode#focus(d5ac21b21379c79c).(const CallIdentifiercxx . . $ QTJSC/CallIdentifier#& callIdentifier) |
| 236 | { |
| 237 | if (!m_visiblecxx . . $ QTJSC/ProfileNode#m_visible.) |
| 238 | return false; |
| 239 | |
| 240 | if (m_callIdentifier != callIdentifier) { |
| 241 | m_visiblecxx . . $ QTJSC/ProfileNode#m_visible. = false; |
| 242 | return true; |
| 243 | } |
| 244 | |
| 245 | for (ProfileNodecxx . . $ QTJSC/ProfileNode#* currentParent = m_parentcxx . . $ QTJSC/ProfileNode#m_parent.; currentParent; currentParent = currentParent->parentcxx . . $ QTJSC/ProfileNode#parent(52aa179bc17c0068).()) |
| 246 | currentParent->setVisiblecxx . . $ QTJSC/ProfileNode#setVisible(b45ddcbc8423892c).(true); |
| 247 | |
| 248 | return false; |
| 249 | } |
| 250 | |
| 251 | void ProfileNodecxx . . $ QTJSC/ProfileNode#::excludecxx . . $ QTJSC/ProfileNode#exclude(8a1d71aab8ab5a09).(const CallIdentifiercxx . . $ QTJSC/CallIdentifier#& callIdentifier) |
| 252 | { |
| 253 | if (m_visible && m_callIdentifier == callIdentifier) { |
| 254 | setTreeVisiblecxx . . $ QTJSC/ProfileNode#setTreeVisible(d50a14f335a65df5).(this, false); |
| 255 | |
| 256 | m_parentcxx . . $ QTJSC/ProfileNode#m_parent.->setVisibleSelfTimecxx . . $ QTJSC/ProfileNode#setVisibleSelfTime(ba8836b59fb42830).(m_parentcxx . . $ QTJSC/ProfileNode#m_parent.->selfTimecxx . . $ QTJSC/ProfileNode#selfTime(21b6c25e127938e2).() + m_visibleTotalTimecxx . . $ QTJSC/ProfileNode#m_visibleTotalTime.); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | void ProfileNodecxx . . $ QTJSC/ProfileNode#::restorecxx . . $ QTJSC/ProfileNode#restore(49f6e7a06ebc5aa8).() |
| 261 | { |
| 262 | m_visibleTotalTimecxx . . $ QTJSC/ProfileNode#m_visibleTotalTime. = m_actualTotalTimecxx . . $ QTJSC/ProfileNode#m_actualTotalTime.; |
| 263 | m_visibleSelfTimecxx . . $ QTJSC/ProfileNode#m_visibleSelfTime. = m_actualSelfTimecxx . . $ QTJSC/ProfileNode#m_actualSelfTime.; |
| 264 | m_visiblecxx . . $ QTJSC/ProfileNode#m_visible. = true; |
| 265 | } |
| 266 | |
| 267 | void ProfileNodecxx . . $ QTJSC/ProfileNode#::endAndRecordCallcxx . . $ QTJSC/ProfileNode#endAndRecordCall(49f6e7a06ebc5aa8).() |
| 268 | { |
| 269 | m_actualTotalTimecxx . . $ QTJSC/ProfileNode#m_actualTotalTime. += m_startTimecxx . . $ QTJSC/ProfileNode#m_startTime. ? getCountcxx . . $ QTJSC/getCount(31fa7155c10fdd13).() - m_startTimecxx . . $ QTJSC/ProfileNode#m_startTime. : 0.0; |
| 270 | m_startTimecxx . . $ QTJSC/ProfileNode#m_startTime. = 0.0; |
| 271 | |
| 272 | ++m_numberOfCallscxx . . $ QTJSC/ProfileNode#m_numberOfCalls.; |
| 273 | } |
| 274 | |
| 275 | void ProfileNodecxx . . $ QTJSC/ProfileNode#::startTimercxx . . $ QTJSC/ProfileNode#startTimer(49f6e7a06ebc5aa8).() |
| 276 | { |
| 277 | if (!m_startTimecxx . . $ QTJSC/ProfileNode#m_startTime.) |
| 278 | m_startTimecxx . . $ QTJSC/ProfileNode#m_startTime. = getCountcxx . . $ QTJSC/getCount(31fa7155c10fdd13).(); |
| 279 | } |
| 280 | |
| 281 | void ProfileNodecxx . . $ QTJSC/ProfileNode#::resetChildrensSiblingscxx . . $ QTJSC/ProfileNode#resetChildrensSiblings(49f6e7a06ebc5aa8).() |
| 282 | { |
| 283 | unsigned size = m_children.size(); |
| 284 | for (unsigned i = 0; i < size; ++i) |
| 285 | m_children[i]->setNextSibling(i + 1 == size ? 0 : m_children[i + 1].get()); |
| 286 | } |
| 287 | |
| 288 | #ifndef NDEBUGcxx . . $ `<built-in>:472:9`! |
| 289 | void ProfileNode::debugPrintData(int indentLevel) const |
| 290 | { |
| 291 | // Print function names |
| 292 | for (int i = 0; i < indentLevel; ++i) |
| 293 | printf(" "); |
| 294 | |
| 295 | printf("Function Name %s %d SelfTime %.3fms/%.3f%% TotalTime %.3fms/%.3f%% VSelf %.3fms VTotal %.3fms Visible %s Next Sibling %s\n", |
| 296 | functionName().UTF8String().c_str(), |
| 297 | m_numberOfCalls, m_actualSelfTime, selfPercent(), m_actualTotalTime, totalPercent(), |
| 298 | m_visibleSelfTime, m_visibleTotalTime, |
| 299 | (m_visible ? "True" : "False"), |
| 300 | m_nextSibling ? m_nextSibling->functionName().UTF8String().c_str() : ""); |
| 301 | |
| 302 | ++indentLevel; |
| 303 | |
| 304 | // Print children's names and information |
| 305 | for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild) |
| 306 | (*currentChild)->debugPrintData(indentLevel); |
| 307 | } |
| 308 | |
| 309 | // print the profiled data in a format that matches the tool sample's output. |
| 310 | double ProfileNode::debugPrintDataSampleStyle(int indentLevel, FunctionCallHashCount& countedFunctions) const |
| 311 | { |
| 312 | printf(" "); |
| 313 | |
| 314 | // Print function names |
| 315 | const char* name = functionName().UTF8String().c_str(); |
| 316 | double sampleCount = m_actualTotalTime * 1000; |
| 317 | if (indentLevel) { |
| 318 | for (int i = 0; i < indentLevel; ++i) |
| 319 | printf(" "); |
| 320 | |
| 321 | countedFunctions.add(functionName().rep()); |
| 322 | |
| 323 | printf("%.0f %s\n", sampleCount ? sampleCount : 1, name); |
| 324 | } else |
| 325 | printf("%s\n", name); |
| 326 | |
| 327 | ++indentLevel; |
| 328 | |
| 329 | // Print children's names and information |
| 330 | double sumOfChildrensCount = 0.0; |
| 331 | for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild) |
| 332 | sumOfChildrensCount += (*currentChild)->debugPrintDataSampleStyle(indentLevel, countedFunctions); |
| 333 | |
| 334 | sumOfChildrensCount *= 1000; // |
| 335 | // Print remainder of samples to match sample's output |
| 336 | if (sumOfChildrensCount < sampleCount) { |
| 337 | printf(" "); |
| 338 | while (indentLevel--) |
| 339 | printf(" "); |
| 340 | |
| 341 | printf("%.0f %s\n", sampleCount - sumOfChildrensCount, functionName().UTF8String().c_str()); |
| 342 | } |
| 343 | |
| 344 | return m_actualTotalTime; |
| 345 | } |
| 346 | #endif |
| 347 | |
| 348 | } // namespace JSC |