Fix plugin loading profiling report

We print a report both before and after a plugin's initialization method
is called, but only the time spent till after the method call should be
counted.
This makes a different for the delayedInitialize cycle: Before
delayedInitialize is called of a plugin, there can be a delay after the
previous one. But this delay should not be counted as part of the
initialization time of the plugin.

Change-Id: I4e5fb53cd83cb36a45a599cfc3f1f8539f6327f9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Eike Ziller
2018-09-28 10:25:34 +02:00
parent 18a6265f13
commit e2e9707510

View File

@@ -1525,16 +1525,16 @@ void PluginManagerPrivate::profilingReport(const char *what, const PluginSpec *s
const int absoluteElapsedMS = m_profileTimer->elapsed(); const int absoluteElapsedMS = m_profileTimer->elapsed();
const int elapsedMS = absoluteElapsedMS - m_profileElapsedMS; const int elapsedMS = absoluteElapsedMS - m_profileElapsedMS;
m_profileElapsedMS = absoluteElapsedMS; m_profileElapsedMS = absoluteElapsedMS;
if (spec)
m_profileTotal[spec] += elapsedMS;
if (spec) if (spec)
qDebug("%-22s %-22s %8dms (%8dms)", what, qPrintable(spec->name()), absoluteElapsedMS, elapsedMS); qDebug("%-22s %-22s %8dms (%8dms)", what, qPrintable(spec->name()), absoluteElapsedMS, elapsedMS);
else else
qDebug("%-45s %8dms (%8dms)", what, absoluteElapsedMS, elapsedMS); qDebug("%-45s %8dms (%8dms)", what, absoluteElapsedMS, elapsedMS);
if (what && *what == '<') { if (what && *what == '<') {
QString tc; QString tc;
if (spec) if (spec) {
m_profileTotal[spec] += elapsedMS;
tc = spec->name() + '_'; tc = spec->name() + '_';
}
tc += QString::fromUtf8(QByteArray(what + 1)); tc += QString::fromUtf8(QByteArray(what + 1));
Utils::Benchmarker::report("loadPlugins", tc, elapsedMS); Utils::Benchmarker::report("loadPlugins", tc, elapsedMS);
} }