forked from qt-creator/qt-creator
QmlProfiler: Disambiguate parent/child terminology in statistics
When talking about call stacks call them "caller" and "callee". Call the invisible root item of the model "rootItem". Change-Id: I551b23f1491d391145193901d3f3a29ab3942089 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -140,7 +140,7 @@ void QmlProfilerStatisticsModel::clear()
|
||||
void QmlProfilerStatisticsModel::setRelativesModel(QmlProfilerStatisticsRelativesModel *relative,
|
||||
QmlProfilerStatisticsRelation relation)
|
||||
{
|
||||
if (relation == QmlProfilerStatisticsParents)
|
||||
if (relation == QmlProfilerStatisticsCallers)
|
||||
m_callersModel = relative;
|
||||
else
|
||||
m_calleesModel = relative;
|
||||
@@ -311,11 +311,11 @@ void QmlProfilerStatisticsRelativesModel::loadEvent(RangeType type, const QmlEve
|
||||
stack.push({event.timestamp(), event.typeIndex()});
|
||||
break;
|
||||
case RangeEnd: {
|
||||
int parentTypeIndex = stack.count() > 1 ? stack[stack.count() - 2].typeId : -1;
|
||||
int relativeTypeIndex = (m_relation == QmlProfilerStatisticsParents) ? parentTypeIndex :
|
||||
int callerTypeIndex = stack.count() > 1 ? stack[stack.count() - 2].typeId : -1;
|
||||
int relativeTypeIndex = (m_relation == QmlProfilerStatisticsCallers) ? callerTypeIndex :
|
||||
event.typeIndex();
|
||||
int selfTypeIndex = (m_relation == QmlProfilerStatisticsParents) ? event.typeIndex() :
|
||||
parentTypeIndex;
|
||||
int selfTypeIndex = (m_relation == QmlProfilerStatisticsCallers) ? event.typeIndex() :
|
||||
callerTypeIndex;
|
||||
|
||||
QmlStatisticsRelativesMap &relativesMap = m_data[selfTypeIndex];
|
||||
QmlStatisticsRelativesMap::Iterator it = relativesMap.find(relativeTypeIndex);
|
||||
|
||||
@@ -41,8 +41,8 @@ class QmlProfilerModelManager;
|
||||
class QmlProfilerStatisticsRelativesModel;
|
||||
|
||||
enum QmlProfilerStatisticsRelation {
|
||||
QmlProfilerStatisticsChilden,
|
||||
QmlProfilerStatisticsParents
|
||||
QmlProfilerStatisticsCallees,
|
||||
QmlProfilerStatisticsCallers
|
||||
};
|
||||
|
||||
class QmlProfilerStatisticsModel : public QObject
|
||||
|
||||
@@ -153,7 +153,7 @@ static QString displayHeader(RelativeField header, QmlProfilerStatisticsRelation
|
||||
{
|
||||
switch (header) {
|
||||
case RelativeLocation:
|
||||
return relation == QmlProfilerStatisticsChilden
|
||||
return relation == QmlProfilerStatisticsCallees
|
||||
? QmlProfilerStatisticsMainView::tr("Callee")
|
||||
: QmlProfilerStatisticsMainView::tr("Caller");
|
||||
case RelativeType:
|
||||
@@ -163,7 +163,7 @@ static QString displayHeader(RelativeField header, QmlProfilerStatisticsRelation
|
||||
case RelativeCallCount:
|
||||
return displayHeader(MainCallCount);
|
||||
case RelativeDetails:
|
||||
return relation == QmlProfilerStatisticsChilden
|
||||
return relation == QmlProfilerStatisticsCallees
|
||||
? QmlProfilerStatisticsMainView::tr("Callee Description")
|
||||
: QmlProfilerStatisticsMainView::tr("Caller Description");
|
||||
case MaxRelativeField:
|
||||
@@ -198,10 +198,10 @@ QmlProfilerStatisticsView::QmlProfilerStatisticsView(QmlProfilerModelManager *pr
|
||||
|
||||
m_calleesView.reset(new QmlProfilerStatisticsRelativesView(
|
||||
new QmlProfilerStatisticsRelativesModel(profilerModelManager, model,
|
||||
QmlProfilerStatisticsChilden)));
|
||||
QmlProfilerStatisticsCallees)));
|
||||
m_callersView.reset(new QmlProfilerStatisticsRelativesView(
|
||||
new QmlProfilerStatisticsRelativesModel(profilerModelManager, model,
|
||||
QmlProfilerStatisticsParents)));
|
||||
QmlProfilerStatisticsCallers)));
|
||||
connect(m_mainView.get(), &QmlProfilerStatisticsMainView::typeSelected,
|
||||
m_calleesView.get(), &QmlProfilerStatisticsRelativesView::displayType);
|
||||
connect(m_mainView.get(), &QmlProfilerStatisticsMainView::typeSelected,
|
||||
@@ -457,16 +457,16 @@ void QmlProfilerStatisticsMainView::updateNotes(int typeIndex)
|
||||
{
|
||||
const QHash<int, QmlProfilerStatisticsModel::QmlEventStats> &eventList = m_model->getData();
|
||||
const QHash<int, QString> ¬eList = m_model->getNotes();
|
||||
QStandardItem *parentItem = m_standardItemModel->invisibleRootItem();
|
||||
QStandardItem *rootItem = m_standardItemModel->invisibleRootItem();
|
||||
|
||||
for (int rowIndex = 0; rowIndex < parentItem->rowCount(); ++rowIndex) {
|
||||
int rowType = parentItem->child(rowIndex)->data(TypeIdRole).toInt();
|
||||
for (int rowIndex = 0; rowIndex < rootItem->rowCount(); ++rowIndex) {
|
||||
int rowType = rootItem->child(rowIndex)->data(TypeIdRole).toInt();
|
||||
if (rowType != typeIndex && typeIndex != -1)
|
||||
continue;
|
||||
const QmlProfilerStatisticsModel::QmlEventStats &stats = eventList[rowType];
|
||||
|
||||
for (int columnIndex = 0; columnIndex < parentItem->columnCount(); ++columnIndex) {
|
||||
QStandardItem *item = parentItem->child(rowIndex, columnIndex);
|
||||
for (int columnIndex = 0; columnIndex < rootItem->columnCount(); ++columnIndex) {
|
||||
QStandardItem *item = rootItem->child(rowIndex, columnIndex);
|
||||
QHash<int, QString>::ConstIterator it = noteList.find(rowType);
|
||||
if (it != noteList.end()) {
|
||||
item->setBackground(colors()->noteBackground);
|
||||
@@ -513,7 +513,7 @@ void QmlProfilerStatisticsMainView::parseModel()
|
||||
int typeIndex = it.key();
|
||||
const QmlProfilerStatisticsModel::QmlEventStats &stats = it.value();
|
||||
const QmlEventType &type = (typeIndex != -1 ? typeList[typeIndex] : *rootEventType());
|
||||
QStandardItem *parentItem = m_standardItemModel->invisibleRootItem();
|
||||
QStandardItem *rootItem = m_standardItemModel->invisibleRootItem();
|
||||
QList<QStandardItem *> newRow;
|
||||
|
||||
newRow << new StatisticsViewItem(
|
||||
@@ -569,7 +569,7 @@ void QmlProfilerStatisticsMainView::parseModel()
|
||||
first->setData(location.column(), ColumnRole);
|
||||
|
||||
// append
|
||||
parentItem->appendRow(newRow);
|
||||
rootItem->appendRow(newRow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user