| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4profiling.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | namespace QV4 { | - | ||||||
| 5 | namespace Profiling { | - | ||||||
| 6 | - | |||||||
| 7 | FunctionLocation FunctionCall::resolveLocation() const | - | ||||||
| 8 | { | - | ||||||
| 9 | return executed 8 times by 1 test: FunctionLocation(m_function->name()->toQString(),return FunctionLocation(m_function->name()->toQString(), m_function->compilationUnit->fileName(), m_function->compiledFunction->location.line, m_function->compiledFunction->location.column);Executed by:
executed 8 times by 1 test: return FunctionLocation(m_function->name()->toQString(), m_function->compilationUnit->fileName(), m_function->compiledFunction->location.line, m_function->compiledFunction->location.column);Executed by:
| 8 | ||||||
| 10 | m_function->compilationUnit->fileName(), executed 8 times by 1 test: return FunctionLocation(m_function->name()->toQString(), m_function->compilationUnit->fileName(), m_function->compiledFunction->location.line, m_function->compiledFunction->location.column);Executed by:
| 8 | ||||||
| 11 | m_function->compiledFunction->location.line, executed 8 times by 1 test: return FunctionLocation(m_function->name()->toQString(), m_function->compilationUnit->fileName(), m_function->compiledFunction->location.line, m_function->compiledFunction->location.column);Executed by:
| 8 | ||||||
| 12 | m_function->compiledFunction->location.column); executed 8 times by 1 test: return FunctionLocation(m_function->name()->toQString(), m_function->compilationUnit->fileName(), m_function->compiledFunction->location.line, m_function->compiledFunction->location.column);Executed by:
| 8 | ||||||
| 13 | } | - | ||||||
| 14 | - | |||||||
| 15 | FunctionCallProperties FunctionCall::properties() const | - | ||||||
| 16 | { | - | ||||||
| 17 | FunctionCallProperties props = { | - | ||||||
| 18 | m_start, | - | ||||||
| 19 | m_end, | - | ||||||
| 20 | reinterpret_cast<quintptr>(m_function) | - | ||||||
| 21 | }; | - | ||||||
| 22 | return executed 14 times by 1 test: props;return props;Executed by:
executed 14 times by 1 test: return props;Executed by:
| 14 | ||||||
| 23 | } | - | ||||||
| 24 | - | |||||||
| 25 | Profiler::Profiler(QV4::ExecutionEngine *engine) : featuresEnabled(0), m_engine(engine) | - | ||||||
| 26 | { | - | ||||||
| 27 | static const int metatypes[] = { | - | ||||||
| 28 | qRegisterMetaType<QVector<QV4::Profiling::FunctionCallProperties> >(), | - | ||||||
| 29 | qRegisterMetaType<QVector<QV4::Profiling::MemoryAllocationProperties> >(), | - | ||||||
| 30 | qRegisterMetaType<FunctionLocationHash>() | - | ||||||
| 31 | }; | - | ||||||
| 32 | (void)metatypes;; | - | ||||||
| 33 | m_timer.start(); | - | ||||||
| 34 | } executed 32 times by 3 tests: end of blockExecuted by:
| 32 | ||||||
| 35 | - | |||||||
| 36 | void Profiler::stopProfiling() | - | ||||||
| 37 | { | - | ||||||
| 38 | featuresEnabled = 0; | - | ||||||
| 39 | reportData(); | - | ||||||
| 40 | m_sentLocations.clear(); | - | ||||||
| 41 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||
| 42 | - | |||||||
| 43 | bool operator<(const FunctionCall &call1, const FunctionCall &call2) | - | ||||||
| 44 | { | - | ||||||
| 45 | return executed 8 times by 1 test: call1.m_start < call2.m_start ||return call1.m_start < call2.m_start || (call1.m_start == call2.m_start && (call1.m_end < call2.m_end || (call1.m_end == call2.m_end && call1.m_function < call2.m_function)));Executed by:
executed 8 times by 1 test: return call1.m_start < call2.m_start || (call1.m_start == call2.m_start && (call1.m_end < call2.m_end || (call1.m_end == call2.m_end && call1.m_function < call2.m_function)));Executed by:
| 8 | ||||||
| 46 | (call1.m_start == call2.m_start && (call1.m_end < call2.m_end || executed 8 times by 1 test: return call1.m_start < call2.m_start || (call1.m_start == call2.m_start && (call1.m_end < call2.m_end || (call1.m_end == call2.m_end && call1.m_function < call2.m_function)));Executed by:
| 8 | ||||||
| 47 | (call1.m_end == call2.m_end && call1.m_function < call2.m_function))); executed 8 times by 1 test: return call1.m_start < call2.m_start || (call1.m_start == call2.m_start && (call1.m_end < call2.m_end || (call1.m_end == call2.m_end && call1.m_function < call2.m_function)));Executed by:
| 8 | ||||||
| 48 | } | - | ||||||
| 49 | - | |||||||
| 50 | void Profiler::reportData() | - | ||||||
| 51 | { | - | ||||||
| 52 | std::sort(m_data.begin(), m_data.end()); | - | ||||||
| 53 | QVector<FunctionCallProperties> properties; | - | ||||||
| 54 | FunctionLocationHash locations; | - | ||||||
| 55 | properties.reserve(m_data.size()); | - | ||||||
| 56 | - | |||||||
| 57 | for (const FunctionCall &call : qAsConst(m_data)) { | - | ||||||
| 58 | properties.append(call.properties()); | - | ||||||
| 59 | Function *function = call.function(); | - | ||||||
| 60 | SentMarker &marker = m_sentLocations[reinterpret_cast<quintptr>(function)]; | - | ||||||
| 61 | if (!marker.isValid()
| 6-8 | ||||||
| 62 | FunctionLocation &location = locations[properties.constLast().id]; | - | ||||||
| 63 | if (!location.isValid()
| 0-8 | ||||||
| 64 | location = call.resolveLocation(); executed 8 times by 1 test: location = call.resolveLocation();Executed by:
| 8 | ||||||
| 65 | marker.setFunction(function); | - | ||||||
| 66 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||
| 67 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||
| 68 | - | |||||||
| 69 | dataReady(locations, properties, m_memory_data); | - | ||||||
| 70 | m_data.clear(); | - | ||||||
| 71 | m_memory_data.clear(); | - | ||||||
| 72 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||
| 73 | - | |||||||
| 74 | void Profiler::startProfiling(quint64 features) | - | ||||||
| 75 | { | - | ||||||
| 76 | if (featuresEnabled == 0
| 0-6 | ||||||
| 77 | if (features & (1 << FeatureMemoryAllocation)
| 0-6 | ||||||
| 78 | qint64 timestamp = m_timer.nsecsElapsed(); | - | ||||||
| 79 | MemoryAllocationProperties heap = {timestamp, | - | ||||||
| 80 | (qint64)m_engine->memoryManager->getAllocatedMem() - | - | ||||||
| 81 | (qint64)m_engine->memoryManager->getLargeItemsMem(), | - | ||||||
| 82 | HeapPage}; | - | ||||||
| 83 | m_memory_data.append(heap); | - | ||||||
| 84 | MemoryAllocationProperties small = {timestamp, | - | ||||||
| 85 | (qint64)m_engine->memoryManager->getUsedMem(), | - | ||||||
| 86 | SmallItem}; | - | ||||||
| 87 | m_memory_data.append(small); | - | ||||||
| 88 | MemoryAllocationProperties large = {timestamp, | - | ||||||
| 89 | (qint64)m_engine->memoryManager->getLargeItemsMem(), | - | ||||||
| 90 | LargeItem}; | - | ||||||
| 91 | m_memory_data.append(large); | - | ||||||
| 92 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||
| 93 | - | |||||||
| 94 | featuresEnabled = features; | - | ||||||
| 95 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||
| 96 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||
| 97 | - | |||||||
| 98 | } | - | ||||||
| 99 | } | - | ||||||
| 100 | - | |||||||
| 101 | - | |||||||
| 102 | - | |||||||
| Switch to Source code | Preprocessed file |