Skip to content

Commit

Permalink
More profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 18, 2020
1 parent 8afe047 commit f48127a
Show file tree
Hide file tree
Showing 3 changed files with 223 additions and 100 deletions.
4 changes: 1 addition & 3 deletions src/app/qgisapp.cpp
Expand Up @@ -847,7 +847,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
endProfile();

// load GUI: actions, menus, toolbars
profiler->start( tr( "Application startup" ) );
startProfile( tr( "Setting up UI" ) );
setupUi( this );
// because mActionToggleMapOnly can hide the menu (thereby disabling menu actions),
Expand All @@ -861,7 +860,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh

//////////

startProfile( tr( "Checking database" ) );
startProfile( tr( "Checking user database" ) );
mSplash->showMessage( tr( "Checking database" ), Qt::AlignHCenter | Qt::AlignBottom );
qApp->processEvents();
// Do this early on before anyone else opens it and prevents us copying it
Expand Down Expand Up @@ -1629,7 +1628,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
#ifdef ANDROID
toggleFullScreen();
#endif
profiler->end();

mStartupProfilerWidgetFactory.reset( qgis::make_unique< QgsProfilerWidgetFactory >( profiler ) );

Expand Down
166 changes: 137 additions & 29 deletions src/core/qgsapplication.cpp
Expand Up @@ -346,10 +346,17 @@ void QgsApplication::init( QString profileFolder )
// so we read actual value in main.cpp
ABISYM( sMaxThreads ) = -1;

colorSchemeRegistry()->addDefaultSchemes();
colorSchemeRegistry()->initStyleScheme();
{
QgsScopedRuntimeProfile profile( tr( "Load color schemes" ) );
colorSchemeRegistry()->addDefaultSchemes();
colorSchemeRegistry()->initStyleScheme();
}

{
QgsScopedRuntimeProfile profile( tr( "Load bookmarks" ) );
bookmarkManager()->initialize( QgsApplication::qgisSettingsDirPath() + "/bookmarks.xml" );
}

bookmarkManager()->initialize( QgsApplication::qgisSettingsDirPath() + "/bookmarks.xml" );
if ( !members()->mStyleModel )
members()->mStyleModel = new QgsStyleModel( QgsStyle::defaultStyle() );

Expand Down Expand Up @@ -2234,33 +2241,134 @@ QgsApplication::ApplicationMembers::ApplicationMembers()
// will need to be careful with the order of creation/destruction
mMessageLog = new QgsMessageLog();
mProfiler = new QgsRuntimeProfiler();
mConnectionRegistry = new QgsConnectionRegistry();
mTaskManager = new QgsTaskManager();
mActionScopeRegistry = new QgsActionScopeRegistry();
mNumericFormatRegistry = new QgsNumericFormatRegistry();
mFieldFormatterRegistry = new QgsFieldFormatterRegistry();
mSvgCache = new QgsSvgCache();
mImageCache = new QgsImageCache();
mColorSchemeRegistry = new QgsColorSchemeRegistry();
mPaintEffectRegistry = new QgsPaintEffectRegistry();
mSymbolLayerRegistry = new QgsSymbolLayerRegistry();
mCalloutRegistry = new QgsCalloutRegistry();
mRendererRegistry = new QgsRendererRegistry();
mRasterRendererRegistry = new QgsRasterRendererRegistry();
mGpsConnectionRegistry = new QgsGpsConnectionRegistry();
mPluginLayerRegistry = new QgsPluginLayerRegistry();
mProcessingRegistry = new QgsProcessingRegistry();

{
mProfiler->start( tr( "Create connection registry" ) );
mConnectionRegistry = new QgsConnectionRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup task manager" ) );
mTaskManager = new QgsTaskManager();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup action scope registry" ) );
mActionScopeRegistry = new QgsActionScopeRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup numeric formats" ) );
mNumericFormatRegistry = new QgsNumericFormatRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup field formats" ) );
mFieldFormatterRegistry = new QgsFieldFormatterRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup SVG cache" ) );
mSvgCache = new QgsSvgCache();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup image cache" ) );
mImageCache = new QgsImageCache();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup color scheme registry" ) );
mColorSchemeRegistry = new QgsColorSchemeRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup paint effect" ) );
mPaintEffectRegistry = new QgsPaintEffectRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup symbol layer registry" ) );
mSymbolLayerRegistry = new QgsSymbolLayerRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup callout registry" ) );
mCalloutRegistry = new QgsCalloutRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup renderer registry" ) );
mRendererRegistry = new QgsRendererRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup raster renderer registry" ) );
mRasterRendererRegistry = new QgsRasterRendererRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup GPS registry" ) );
mGpsConnectionRegistry = new QgsGpsConnectionRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup plugin layer registry" ) );
mPluginLayerRegistry = new QgsPluginLayerRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup Processing registry" ) );
mProcessingRegistry = new QgsProcessingRegistry();
mProfiler->end();
}
mPageSizeRegistry = new QgsPageSizeRegistry();
mLayoutItemRegistry = new QgsLayoutItemRegistry();
mLayoutItemRegistry->populate();
mAnnotationRegistry = new QgsAnnotationRegistry();
m3DRendererRegistry = new Qgs3DRendererRegistry();
mProjectStorageRegistry = new QgsProjectStorageRegistry();
mNetworkContentFetcherRegistry = new QgsNetworkContentFetcherRegistry();
mValidityCheckRegistry = new QgsValidityCheckRegistry();
mClassificationMethodRegistry = new QgsClassificationMethodRegistry();
mBookmarkManager = new QgsBookmarkManager( nullptr );
mScaleBarRendererRegistry = new QgsScaleBarRendererRegistry();
{
mProfiler->start( tr( "Setup layout item registry" ) );
mLayoutItemRegistry = new QgsLayoutItemRegistry();
mLayoutItemRegistry->populate();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup annotation registry" ) );
mAnnotationRegistry = new QgsAnnotationRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup 3D renderer registry" ) );
m3DRendererRegistry = new Qgs3DRendererRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup project storage registry" ) );
mProjectStorageRegistry = new QgsProjectStorageRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup network content cache" ) );
mNetworkContentFetcherRegistry = new QgsNetworkContentFetcherRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup layout check registry" ) );
mValidityCheckRegistry = new QgsValidityCheckRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup classification registry" ) );
mClassificationMethodRegistry = new QgsClassificationMethodRegistry();
mProfiler->end();
}
{
mProfiler->start( tr( "Setup bookmark manager" ) );
mBookmarkManager = new QgsBookmarkManager( nullptr );
mProfiler->end();
}
{
mProfiler->start( tr( "Setup scalebar registry" ) );
mScaleBarRendererRegistry = new QgsScaleBarRendererRegistry();
mProfiler->end();
}
}

QgsApplication::ApplicationMembers::~ApplicationMembers()
Expand Down

0 comments on commit f48127a

Please sign in to comment.