QVariantMap MemoryUsageModel::details(int index) const { QVariantMap result; const MemoryAllocationItem *ev = &m_data[index]; if (ev->allocated >= -ev->deallocated) result.insert(QLatin1String("displayName"), tr("Memory Allocated")); else result.insert(QLatin1String("displayName"), tr("Memory Freed")); result.insert(tr("Total"), tr("%1 bytes").arg(ev->size)); if (ev->allocations > 0) { result.insert(tr("Allocated"), tr("%1 bytes").arg(ev->allocated)); result.insert(tr("Allocations"), QString::number(ev->allocations)); } if (ev->deallocations > 0) { result.insert(tr("Deallocated"), tr("%1 bytes").arg(-ev->deallocated)); result.insert(tr("Deallocations"), QString::number(ev->deallocations)); } QString memoryTypeName; switch (selectionId(index)) { case HeapPage: memoryTypeName = tr("Heap Allocation"); break; case LargeItem: memoryTypeName = tr("Large Item Allocation"); break; case SmallItem: memoryTypeName = tr("Heap Usage"); break; default: Q_UNREACHABLE(); } result.insert(tr("Type"), memoryTypeName); result.insert(tr("Location"), modelManager()->qmlModel()->eventTypes().at(ev->typeId).displayName()); return result; }
QVariantMap QmlProfilerAnimationsModel::details(int index) const { QVariantMap result; result.insert(QStringLiteral("displayName"), displayName()); result.insert(tr("Duration"), Timeline::formatTime(duration(index))); result.insert(tr("Framerate"), QString::fromLatin1("%1 FPS").arg(m_data[index].framerate)); result.insert(tr("Animations"), QString::number(m_data[index].animationcount)); result.insert(tr("Context"), selectionId(index) == GuiThread ? tr("GUI Thread") : tr("Render Thread")); return result; }
QVariantMap QmlProfilerRangeModel::location(int index) const { QVariantMap result; int id = selectionId(index); const QmlDebug::QmlEventLocation &location = modelManager()->qmlModel()->getEventTypes().at(id).location; result.insert(QStringLiteral("file"), location.filename); result.insert(QStringLiteral("line"), location.line); result.insert(QStringLiteral("column"), location.column); return result; }
QVariantMap QmlProfilerRangeModel::details(int index) const { QVariantMap result; int id = selectionId(index); result.insert(QStringLiteral("displayName"), tr(QmlProfilerModelManager::featureName(mainFeature()))); result.insert(tr("Duration"), Timeline::formatTime(duration(index))); const QmlEventType &type = modelManager()->eventType(id); result.insert(tr("Details"), type.data()); result.insert(tr("Location"), type.displayName()); return result; }
QVariantMap QmlProfilerRangeModel::details(int index) const { QVariantMap result; int id = selectionId(index); const QVector<QmlProfilerDataModel::QmlEventTypeData> &types = modelManager()->qmlModel()->getEventTypes(); result.insert(QStringLiteral("displayName"), tr(QmlProfilerModelManager::featureName(mainFeature()))); result.insert(tr("Duration"), QmlProfilerBaseModel::formatTime(duration(index))); result.insert(tr("Details"), types[id].data); result.insert(tr("Location"), types[id].displayName); return result; }
int QmlProfilerRangeModel::typeId(int index) const { return selectionId(index); }
float QmlProfilerAnimationsModel::relativeHeight(int index) const { return (float)m_data[index].animationcount / (float)(selectionId(index) == GuiThread ? m_maxGuiThreadAnimations : m_maxRenderThreadAnimations); }
int QmlProfilerAnimationsModel::collapsedRow(int index) const { return rowFromThreadId(selectionId(index)); }
int InputEventsModel::expandedRow(int index) const { return selectionId(index) == Mouse ? 1 : 2; }
int MemoryUsageModel::expandedRow(int index) const { int type = selectionId(index); return (type == HeapPage || type == LargeItem) ? 1 : 2; }
int DebugMessagesModel::expandedRow(int index) const { return selectionId(index) + 1; }