forked from qt-creator/qt-creator
Show summary when using -profile command line option
Change-Id: Ieeec4be993b1c53a59407349d365a6aaf1a92e32 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
@@ -837,6 +837,7 @@ void PluginManagerPrivate::nextDelayedInitialize()
|
||||
if (delayedInitializeQueue.isEmpty()) {
|
||||
delete delayedInitializeTimer;
|
||||
delayedInitializeTimer = 0;
|
||||
profilingSummary();
|
||||
emit q->initializationDone();
|
||||
} else {
|
||||
delayedInitializeTimer->start();
|
||||
@@ -1308,6 +1309,7 @@ void PluginManagerPrivate::profilingReport(const char *what, const PluginSpec *s
|
||||
const int absoluteElapsedMS = m_profileTimer->elapsed();
|
||||
const int elapsedMS = absoluteElapsedMS - m_profileElapsedMS;
|
||||
m_profileElapsedMS = absoluteElapsedMS;
|
||||
m_profileTotal[spec] += elapsedMS;
|
||||
if (spec)
|
||||
qDebug("%-22s %-22s %8dms (%8dms)", what, qPrintable(spec->name()), absoluteElapsedMS, elapsedMS);
|
||||
else
|
||||
@@ -1315,6 +1317,24 @@ void PluginManagerPrivate::profilingReport(const char *what, const PluginSpec *s
|
||||
}
|
||||
}
|
||||
|
||||
void PluginManagerPrivate::profilingSummary() const
|
||||
{
|
||||
if (!m_profileTimer.isNull()) {
|
||||
typedef QMultiMap<int, const PluginSpec *> Sorter;
|
||||
Sorter sorter;
|
||||
|
||||
QHash<const PluginSpec *, int>::ConstIterator it1 = m_profileTotal.constBegin();
|
||||
QHash<const PluginSpec *, int>::ConstIterator et1 = m_profileTotal.constEnd();
|
||||
for (; it1 != et1; ++it1)
|
||||
sorter.insert(it1.value(), it1.key());
|
||||
|
||||
Sorter::ConstIterator it2 = sorter.begin();
|
||||
Sorter::ConstIterator et2 = sorter.end();
|
||||
for (; it2 != et2; ++it2)
|
||||
qDebug("%-22s %8dms", qPrintable(it2.value()->name()), it2.key());
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void PluginManager::getObjectByName(const QString &name) const
|
||||
\brief Retrieves one object with a given name from the object pool.
|
||||
|
||||
Reference in New Issue
Block a user