forked from qt-creator/qt-creator
QmlProfiler: hiding extra statistics by default
User can choose to see them through the context menu. Change-Id: Ibf1670098126658af497c7a87b46c26f6dd2d41e Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -195,6 +195,16 @@ bool QmlProfilerEventsWidget::hasGlobalStats() const
|
|||||||
return m_globalStatsEnabled;
|
return m_globalStatsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlProfilerEventsWidget::setShowExtendedStatistics(bool show)
|
||||||
|
{
|
||||||
|
m_eventTree->setShowExtendedStatistics(show);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QmlProfilerEventsWidget::showExtendedStatistics() const
|
||||||
|
{
|
||||||
|
return m_eventTree->showExtendedStatistics();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class QmlProfilerEventsMainView::QmlProfilerEventsMainViewPrivate
|
class QmlProfilerEventsMainView::QmlProfilerEventsMainViewPrivate
|
||||||
@@ -215,8 +225,9 @@ public:
|
|||||||
QmlProfilerEventList *m_eventStatistics;
|
QmlProfilerEventList *m_eventStatistics;
|
||||||
QStandardItemModel *m_model;
|
QStandardItemModel *m_model;
|
||||||
QList<bool> m_fieldShown;
|
QList<bool> m_fieldShown;
|
||||||
|
QHash<int, int> m_columnIndex; // maps field enum to column index
|
||||||
|
bool m_showExtendedStatistics;
|
||||||
int m_firstNumericColumn;
|
int m_firstNumericColumn;
|
||||||
int m_detailsColumn;
|
|
||||||
bool m_preventSelectBounce;
|
bool m_preventSelectBounce;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -241,8 +252,8 @@ QmlProfilerEventsMainView::QmlProfilerEventsMainView(QmlProfilerEventList *model
|
|||||||
setEventStatisticsModel(model);
|
setEventStatisticsModel(model);
|
||||||
|
|
||||||
d->m_firstNumericColumn = 0;
|
d->m_firstNumericColumn = 0;
|
||||||
d->m_detailsColumn = 0;
|
|
||||||
d->m_preventSelectBounce = false;
|
d->m_preventSelectBounce = false;
|
||||||
|
d->m_showExtendedStatistics = false;
|
||||||
|
|
||||||
// default view
|
// default view
|
||||||
setViewType(EventsView);
|
setViewType(EventsView);
|
||||||
@@ -326,38 +337,85 @@ void QmlProfilerEventsMainView::setHeaderLabels()
|
|||||||
int fieldIndex = 0;
|
int fieldIndex = 0;
|
||||||
d->m_firstNumericColumn = 0;
|
d->m_firstNumericColumn = 0;
|
||||||
|
|
||||||
|
d->m_columnIndex.clear();
|
||||||
if (d->m_fieldShown[Name]) {
|
if (d->m_fieldShown[Name]) {
|
||||||
|
d->m_columnIndex[Name] = fieldIndex;
|
||||||
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Location")));
|
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Location")));
|
||||||
d->m_firstNumericColumn++;
|
d->m_firstNumericColumn++;
|
||||||
}
|
}
|
||||||
if (d->m_fieldShown[Type]) {
|
if (d->m_fieldShown[Type]) {
|
||||||
|
d->m_columnIndex[Type] = fieldIndex;
|
||||||
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Type")));
|
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Type")));
|
||||||
d->m_firstNumericColumn++;
|
d->m_firstNumericColumn++;
|
||||||
}
|
}
|
||||||
if (d->m_fieldShown[Percent])
|
if (d->m_fieldShown[Percent]) {
|
||||||
|
d->m_columnIndex[Percent] = fieldIndex;
|
||||||
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Time in Percent")));
|
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Time in Percent")));
|
||||||
if (d->m_fieldShown[TotalDuration])
|
}
|
||||||
|
if (d->m_fieldShown[TotalDuration]) {
|
||||||
|
d->m_columnIndex[TotalDuration] = fieldIndex;
|
||||||
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Total Time")));
|
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Total Time")));
|
||||||
if (d->m_fieldShown[SelfPercent])
|
}
|
||||||
|
if (d->m_fieldShown[SelfPercent]) {
|
||||||
|
d->m_columnIndex[Type] = fieldIndex;
|
||||||
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Self Time in Percent")));
|
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Self Time in Percent")));
|
||||||
if (d->m_fieldShown[SelfDuration])
|
}
|
||||||
|
if (d->m_fieldShown[SelfDuration]) {
|
||||||
|
d->m_columnIndex[SelfDuration] = fieldIndex;
|
||||||
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Self Time")));
|
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Self Time")));
|
||||||
if (d->m_fieldShown[CallCount])
|
}
|
||||||
|
if (d->m_fieldShown[CallCount]) {
|
||||||
|
d->m_columnIndex[CallCount] = fieldIndex;
|
||||||
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Calls")));
|
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Calls")));
|
||||||
if (d->m_fieldShown[TimePerCall])
|
}
|
||||||
|
if (d->m_fieldShown[TimePerCall]) {
|
||||||
|
d->m_columnIndex[TimePerCall] = fieldIndex;
|
||||||
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Mean Time")));
|
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Mean Time")));
|
||||||
if (d->m_fieldShown[MedianTime])
|
}
|
||||||
|
if (d->m_fieldShown[MedianTime]) {
|
||||||
|
d->m_columnIndex[MedianTime] = fieldIndex;
|
||||||
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Median Time")));
|
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Median Time")));
|
||||||
if (d->m_fieldShown[MaxTime])
|
}
|
||||||
|
if (d->m_fieldShown[MaxTime]) {
|
||||||
|
d->m_columnIndex[MaxTime] = fieldIndex;
|
||||||
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Longest Time")));
|
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Longest Time")));
|
||||||
if (d->m_fieldShown[MinTime])
|
}
|
||||||
|
if (d->m_fieldShown[MinTime]) {
|
||||||
|
d->m_columnIndex[MinTime] = fieldIndex;
|
||||||
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Shortest Time")));
|
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Shortest Time")));
|
||||||
|
}
|
||||||
if (d->m_fieldShown[Details]) {
|
if (d->m_fieldShown[Details]) {
|
||||||
d->m_detailsColumn = fieldIndex;
|
d->m_columnIndex[Details] = fieldIndex;
|
||||||
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Details")));
|
d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Details")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlProfilerEventsMainView::setShowExtendedStatistics(bool show)
|
||||||
|
{
|
||||||
|
// Not checking if already set because we don't want the first call to skip
|
||||||
|
d->m_showExtendedStatistics = show;
|
||||||
|
if (show) {
|
||||||
|
if (d->m_fieldShown[MedianTime])
|
||||||
|
showColumn(d->m_columnIndex[MedianTime]);
|
||||||
|
if (d->m_fieldShown[MaxTime])
|
||||||
|
showColumn(d->m_columnIndex[MaxTime]);
|
||||||
|
if (d->m_fieldShown[MinTime])
|
||||||
|
showColumn(d->m_columnIndex[MinTime]);
|
||||||
|
} else{
|
||||||
|
if (d->m_fieldShown[MedianTime])
|
||||||
|
hideColumn(d->m_columnIndex[MedianTime]);
|
||||||
|
if (d->m_fieldShown[MaxTime])
|
||||||
|
hideColumn(d->m_columnIndex[MaxTime]);
|
||||||
|
if (d->m_fieldShown[MinTime])
|
||||||
|
hideColumn(d->m_columnIndex[MinTime]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QmlProfilerEventsMainView::showExtendedStatistics() const
|
||||||
|
{
|
||||||
|
return d->m_showExtendedStatistics;
|
||||||
|
}
|
||||||
|
|
||||||
void QmlProfilerEventsMainView::clear()
|
void QmlProfilerEventsMainView::clear()
|
||||||
{
|
{
|
||||||
d->m_model->clear();
|
d->m_model->clear();
|
||||||
@@ -385,6 +443,8 @@ void QmlProfilerEventsMainView::buildModel()
|
|||||||
else
|
else
|
||||||
d->buildModelFromList( d->m_eventStatistics->getEventDescriptions(), d->m_model->invisibleRootItem() );
|
d->buildModelFromList( d->m_eventStatistics->getEventDescriptions(), d->m_model->invisibleRootItem() );
|
||||||
|
|
||||||
|
setShowExtendedStatistics(d->m_showExtendedStatistics);
|
||||||
|
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
setSortingEnabled(true);
|
setSortingEnabled(true);
|
||||||
sortByColumn(d->m_firstNumericColumn,Qt::DescendingOrder);
|
sortByColumn(d->m_firstNumericColumn,Qt::DescendingOrder);
|
||||||
@@ -650,8 +710,8 @@ void QmlProfilerEventsMainView::changeDetailsForEvent(int eventId, const QString
|
|||||||
for (int i=0; i<d->m_model->rowCount(); i++) {
|
for (int i=0; i<d->m_model->rowCount(); i++) {
|
||||||
QStandardItem *infoItem = d->m_model->item(i, 0);
|
QStandardItem *infoItem = d->m_model->item(i, 0);
|
||||||
if (infoItem->data(EventIdRole).toInt() == eventId) {
|
if (infoItem->data(EventIdRole).toInt() == eventId) {
|
||||||
d->m_model->item(i,d->m_detailsColumn)->setData(QVariant(newString),Qt::DisplayRole);
|
d->m_model->item(i,d->m_columnIndex[Details])->setData(QVariant(newString),Qt::DisplayRole);
|
||||||
d->m_model->item(i,d->m_detailsColumn)->setData(QVariant(newString));
|
d->m_model->item(i,d->m_columnIndex[Details])->setData(QVariant(newString));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -72,6 +72,8 @@ public:
|
|||||||
void copyRowToClipboard() const;
|
void copyRowToClipboard() const;
|
||||||
|
|
||||||
bool hasGlobalStats() const;
|
bool hasGlobalStats() const;
|
||||||
|
void setShowExtendedStatistics(bool show);
|
||||||
|
bool showExtendedStatistics() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
|
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
|
||||||
@@ -142,6 +144,9 @@ public:
|
|||||||
bool isRangeGlobal(qint64 rangeStart, qint64 rangeEnd) const;
|
bool isRangeGlobal(qint64 rangeStart, qint64 rangeEnd) const;
|
||||||
int selectedEventId() const;
|
int selectedEventId() const;
|
||||||
|
|
||||||
|
void setShowExtendedStatistics(bool);
|
||||||
|
bool showExtendedStatistics() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
|
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
|
||||||
void eventSelected(int eventId);
|
void eventSelected(int eventId);
|
||||||
|
@@ -230,6 +230,7 @@ void QmlProfilerTool::showContextMenu(const QPoint &position)
|
|||||||
QAction *saveAction = menu.addAction(tr("Save QML Trace"));
|
QAction *saveAction = menu.addAction(tr("Save QML Trace"));
|
||||||
QAction *copyRowAction = 0;
|
QAction *copyRowAction = 0;
|
||||||
QAction *copyTableAction = 0;
|
QAction *copyTableAction = 0;
|
||||||
|
QAction *showExtendedStatsAction = 0;
|
||||||
QAction *viewAllAction = 0;
|
QAction *viewAllAction = 0;
|
||||||
QAction *getLocalStatsAction = 0;
|
QAction *getLocalStatsAction = 0;
|
||||||
QAction *getGlobalStatsAction = 0;
|
QAction *getGlobalStatsAction = 0;
|
||||||
@@ -239,6 +240,13 @@ void QmlProfilerTool::showContextMenu(const QPoint &position)
|
|||||||
if (eventView->selectedItem().isValid())
|
if (eventView->selectedItem().isValid())
|
||||||
copyRowAction = menu.addAction(tr("Copy Row"));
|
copyRowAction = menu.addAction(tr("Copy Row"));
|
||||||
copyTableAction = menu.addAction(tr("Copy Table"));
|
copyTableAction = menu.addAction(tr("Copy Table"));
|
||||||
|
|
||||||
|
if (eventView == d->m_eventsView) {
|
||||||
|
// only for qml events view, not for v8
|
||||||
|
showExtendedStatsAction = menu.addAction(tr("Extended Event Statistics"));
|
||||||
|
showExtendedStatsAction->setCheckable(true);
|
||||||
|
showExtendedStatsAction->setChecked(eventView->showExtendedStatistics());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sender() == d->m_traceWindow || sender() == d->m_eventsView) {
|
if (sender() == d->m_traceWindow || sender() == d->m_eventsView) {
|
||||||
@@ -281,6 +289,8 @@ void QmlProfilerTool::showContextMenu(const QPoint &position)
|
|||||||
d->m_traceWindow->getEventList()->traceStartTime(),
|
d->m_traceWindow->getEventList()->traceStartTime(),
|
||||||
d->m_traceWindow->getEventList()->traceEndTime());
|
d->m_traceWindow->getEventList()->traceEndTime());
|
||||||
}
|
}
|
||||||
|
if (selectedAction == showExtendedStatsAction)
|
||||||
|
eventView->setShowExtendedStatistics(!eventView->showExtendedStatistics());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user