PluginManager: Add percentages when running with -profile

Change-Id: If47c615eb6e7e5f927f514c7c6fd8c8bbe595fa0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
hjk
2013-02-12 16:43:02 +01:00
parent 922165d4dc
commit 548f953295

View File

@@ -1322,16 +1322,21 @@ void PluginManagerPrivate::profilingSummary() const
if (!m_profileTimer.isNull()) {
typedef QMultiMap<int, const PluginSpec *> Sorter;
Sorter sorter;
int total = 0;
QHash<const PluginSpec *, int>::ConstIterator it1 = m_profileTotal.constBegin();
QHash<const PluginSpec *, int>::ConstIterator et1 = m_profileTotal.constEnd();
for (; it1 != et1; ++it1)
for (; it1 != et1; ++it1) {
sorter.insert(it1.value(), it1.key());
total += it1.value();
}
Sorter::ConstIterator it2 = sorter.begin();
Sorter::ConstIterator et2 = sorter.end();
for (; it2 != et2; ++it2)
qDebug("%-22s %8dms", qPrintable(it2.value()->name()), it2.key());
qDebug("%-22s %8dms ( %5.2f%% )", qPrintable(it2.value()->name()),
it2.key(), 100.0 * it2.key() / total);
qDebug("Total: %8dms", total);
}
}