diff options
author | David Schulz <[email protected]> | 2022-04-27 11:02:16 +0200 |
---|---|---|
committer | David Schulz <[email protected]> | 2022-04-28 10:10:39 +0000 |
commit | e675bb7860d356e9fd1c788b261ab629d0468f9e (patch) | |
tree | 55290bf7836890b2897d70761f1f062fedc18873 /src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp | |
parent | 3cfee2802274bd97f6a84f8c340d90d7edfb1460 (diff) |
QmlProfiler: Use annotions instead of custom icons on marks
To display the relative cost in the editor a custom text mark icon was
painted with a custom width factor for qml profiler marks. Move this
textual information into a line annotation and be a bit more verbose
what kind of information was collected in that line.
Change-Id: I863c2afa52f2acdf19ffcab3dfc95af566ac0efe
Reviewed-by: Ulf Hermann <[email protected]>
Reviewed-by: <[email protected]>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp')
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp index ad203258a6d..92a1b1b623a 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp @@ -156,26 +156,32 @@ QString QmlProfilerStatisticsModel::summary(const QVector<int> &typeIds) const double maximum = 0; double sum = 0; + QSet<RangeType> types; + for (int typeId : typeIds) { + types << m_modelManager->eventType(typeId).rangeType(); const double percentage = durationPercent(typeId); if (percentage > maximum) maximum = percentage; sum += percentage; } + const QStringList typeNames = Utils::transform<QList>(types, &nameForType); + const QString typeSummary = QString(" (%1)").arg(typeNames.join(", ")); + const QLatin1Char percent('%'); if (sum < cutoff) - return QLatin1Char('<') + QString::number(cutoff, 'f', 1) + percent; + return QLatin1Char('<') + QString::number(cutoff, 'f', 1) + percent + typeSummary; if (typeIds.length() == 1) - return QLatin1Char('~') + QString::number(maximum, 'f', 1) + percent; + return QLatin1Char('~') + QString::number(maximum, 'f', 1) + percent + typeSummary; // add/subtract 0.05 to avoid problematic rounding if (maximum < cutoff) - return QChar(0x2264) + QString::number(sum + round, 'f', 1) + percent; + return QChar(0x2264) + QString::number(sum + round, 'f', 1) + percent + typeSummary; - return QChar(0x2265) + QString::number(qMax(maximum - round, cutoff), 'f', 1) + percent; + return QChar(0x2265) + QString::number(qMax(maximum - round, cutoff), 'f', 1) + percent + typeSummary; } void QmlProfilerStatisticsModel::clear() |