Skip to content
Permalink
Browse files

Add some more startup cost logging hooks

  • Loading branch information
nyalldawson committed May 19, 2020
1 parent 1b5cd3a commit a6cd3d1ebd5aa1539ea6c18198e63a329b7f14df
Showing with 36 additions and 7 deletions.
  1. +2 −0 src/app/qgisapp.cpp
  2. +5 −0 src/core/auth/qgsauthmanager.cpp
  3. +29 −7 src/core/qgsproviderregistry.cpp
@@ -11708,6 +11708,8 @@ class QgsPythonRunnerImpl : public QgsPythonRunner

void QgisApp::loadPythonSupport()
{
QgsScopedRuntimeProfile profile( tr( "Loading Python support" ) );

QString pythonlibName( QStringLiteral( "qgispython" ) );
#if defined(Q_OS_UNIX)
pythonlibName.prepend( QgsApplication::libraryPath() );
@@ -52,6 +52,7 @@
#include "qgslogger.h"
#include "qgsmessagelog.h"
#include "qgssettings.h"
#include "qgsruntimeprofiler.h"

QgsAuthManager *QgsAuthManager::sInstance = nullptr;

@@ -173,6 +174,8 @@ bool QgsAuthManager::init( const QString &pluginPath, const QString &authDatabas
return true;
mAuthInit = true;

QgsScopedRuntimeProfile profile( tr( "Initializing authentication manager" ) );

QgsDebugMsgLevel( QStringLiteral( "Initializing QCA..." ), 2 );
mQcaInitializer = qgis::make_unique<QCA::Initializer>( QCA::Practical, 256 );

@@ -1690,6 +1693,8 @@ bool QgsAuthManager::removeAuthSetting( const QString &key )

bool QgsAuthManager::initSslCaches()
{
QgsScopedRuntimeProfile profile( "Initialize SSL cache" );

QMutexLocker locker( mMutex.get() );
bool res = true;
res = res && rebuildCaCertsCache();
@@ -36,6 +36,8 @@
#include "providers/gdal/qgsgdalprovider.h"
#include "providers/ogr/qgsogrprovider.h"
#include "providers/meshmemory/qgsmeshmemorydataprovider.h"
#include "qgsruntimeprofiler.h"

#ifdef HAVE_STATIC_PROVIDERS
#include "qgswmsprovider.h"
#include "qgspostgresprovider.h"
@@ -103,6 +105,8 @@ QgsProviderRegistry::QgsProviderRegistry( const QString &pluginPath )
QString baseDir = appDir.left( bin );
QString mLibraryDirectory = baseDir + "/lib";
#endif

QgsScopedRuntimeProfile profile( QObject::tr( "Initialize data providers" ) );
mLibraryDirectory.setPath( pluginPath );
init();
}
@@ -111,13 +115,28 @@ void QgsProviderRegistry::init()
{
// add static providers
Q_NOWARN_DEPRECATED_PUSH
mProviders[ QgsMemoryProvider::providerKey() ] = new QgsProviderMetadata( QgsMemoryProvider::providerKey(), QgsMemoryProvider::providerDescription(), &QgsMemoryProvider::createProvider );
mProviders[ QgsMeshMemoryDataProvider::providerKey() ] = new QgsProviderMetadata( QgsMeshMemoryDataProvider::providerKey(), QgsMeshMemoryDataProvider::providerDescription(), &QgsMeshMemoryDataProvider::createProvider );
{
QgsScopedRuntimeProfile profile( QObject::tr( "Create memory layer provider" ) );
mProviders[ QgsMemoryProvider::providerKey() ] = new QgsProviderMetadata( QgsMemoryProvider::providerKey(), QgsMemoryProvider::providerDescription(), &QgsMemoryProvider::createProvider );
}
{
QgsScopedRuntimeProfile profile( QObject::tr( "Create mesh memory layer provider" ) );
mProviders[ QgsMeshMemoryDataProvider::providerKey() ] = new QgsProviderMetadata( QgsMeshMemoryDataProvider::providerKey(), QgsMeshMemoryDataProvider::providerDescription(), &QgsMeshMemoryDataProvider::createProvider );
}
Q_NOWARN_DEPRECATED_POP
mProviders[ QgsGdalProvider::providerKey() ] = new QgsGdalProviderMetadata();
mProviders[ QgsOgrProvider::providerKey() ] = new QgsOgrProviderMetadata();
QgsProviderMetadata *vt = new QgsVectorTileProviderMetadata();
mProviders[ vt->key() ] = vt;
{
QgsScopedRuntimeProfile profile( QObject::tr( "Create GDAL provider" ) );
mProviders[ QgsGdalProvider::providerKey() ] = new QgsGdalProviderMetadata();
}
{
QgsScopedRuntimeProfile profile( QObject::tr( "Create OGR provider" ) );
mProviders[ QgsOgrProvider::providerKey() ] = new QgsOgrProviderMetadata();
}
{
QgsScopedRuntimeProfile profile( QObject::tr( "Create vector tile provider" ) );
QgsProviderMetadata *vt = new QgsVectorTileProviderMetadata();
mProviders[ vt->key() ] = vt;
}
#ifdef HAVE_STATIC_PROVIDERS
mProviders[ QgsWmsProvider::providerKey() ] = new QgsWmsProviderMetadata();
mProviders[ QgsPostgresProvider::providerKey() ] = new QgsPostgresProviderMetadata();
@@ -169,6 +188,7 @@ void QgsProviderRegistry::init()
}
}

QgsScopedRuntimeProfile profile( QObject::tr( "Load %1" ).arg( fi.fileName() ) );
QLibrary myLib( fi.filePath() );
if ( !myLib.load() )
{
@@ -228,7 +248,9 @@ void QgsProviderRegistry::init()
for ( Providers::const_iterator it = mProviders.begin(); it != mProviders.end(); ++it )
{
const QString &key = it->first;
Q_UNUSED( key ); // avoid unused variable warning in release build

QgsScopedRuntimeProfile profile( QObject::tr( "Initialize %1" ).arg( key ) );

QgsProviderMetadata *meta = it->second;

// now get vector file filters, if any

0 comments on commit a6cd3d1

Please sign in to comment.
You can’t perform that action at this time.