Skip to content

Commit

Permalink
Add a few more items to startup runtime profiling to help debug slow …
Browse files Browse the repository at this point in the history
…startup
  • Loading branch information
nyalldawson committed May 18, 2020
1 parent 82c298a commit b9ef421
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -833,7 +833,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
sInstance = this;
QgsRuntimeProfiler *profiler = QgsApplication::profiler();

startProfile( tr( "User profile manager" ) );
startProfile( tr( "Create user profile manager" ) );
mUserProfileManager = new QgsUserProfileManager( QString(), this );
mUserProfileManager->setRootLocation( rootProfileLocation );
mUserProfileManager->setActiveUserProfile( activeProfile );
Expand All @@ -842,7 +842,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
endProfile();

// start the network logger early, we want all requests logged!
startProfile( tr( "Network logger" ) );
startProfile( tr( "Create network logger" ) );
mNetworkLogger = new QgsNetworkLogger( QgsNetworkAccessManager::instance(), this );
endProfile();

Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsellipsoidutils.cpp
Expand Up @@ -21,6 +21,7 @@
#include <QCollator>
#include "qgsprojutils.h"
#include "qgsreadwritelocker.h"
#include "qgsruntimeprofiler.h"

#if PROJ_VERSION_MAJOR>=6
#include <proj.h>
Expand Down Expand Up @@ -175,6 +176,7 @@ QgsEllipsoidUtils::EllipsoidParameters QgsEllipsoidUtils::ellipsoidParameters( c
static std::once_flag initialized;
std::call_once( initialized, [ = ]
{
QgsScopedRuntimeProfile profile( QObject::tr( "Initialize ellipsoids" ) );
( void )definitions();
} );

Expand Down
37 changes: 20 additions & 17 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -79,6 +79,7 @@ email : sherman at mrcc.com
#include "qgsrasterlayertemporalproperties.h"
#include "qgsvectorlayertemporalproperties.h"
#include "qgstemporalcontroller.h"
#include "qgsruntimeprofiler.h"

/**
* \ingroup gui
Expand Down Expand Up @@ -143,24 +144,27 @@ QgsMapCanvas::QgsMapCanvas( QWidget *parent )
connect( QgsProject::instance()->mapThemeCollection(), &QgsMapThemeCollection::mapThemeRenamed, this, &QgsMapCanvas::mapThemeRenamed );
connect( QgsProject::instance()->mapThemeCollection(), &QgsMapThemeCollection::mapThemesChanged, this, &QgsMapCanvas::projectThemesChanged );

mSettings.setFlag( QgsMapSettings::DrawEditingInfo );
mSettings.setFlag( QgsMapSettings::UseRenderingOptimization );
mSettings.setFlag( QgsMapSettings::RenderPartialOutput );
mSettings.setEllipsoid( QgsProject::instance()->ellipsoid() );
connect( QgsProject::instance(), &QgsProject::ellipsoidChanged,
this, [ = ]
{
QgsScopedRuntimeProfile profile( "Map settings initialization" );
mSettings.setFlag( QgsMapSettings::DrawEditingInfo );
mSettings.setFlag( QgsMapSettings::UseRenderingOptimization );
mSettings.setFlag( QgsMapSettings::RenderPartialOutput );
mSettings.setEllipsoid( QgsProject::instance()->ellipsoid() );
refresh();
} );
mSettings.setTransformContext( QgsProject::instance()->transformContext() );
connect( QgsProject::instance(), &QgsProject::transformContextChanged,
this, [ = ]
{
connect( QgsProject::instance(), &QgsProject::ellipsoidChanged,
this, [ = ]
{
mSettings.setEllipsoid( QgsProject::instance()->ellipsoid() );
refresh();
} );
mSettings.setTransformContext( QgsProject::instance()->transformContext() );
emit transformContextChanged();
refresh();
} );
connect( QgsProject::instance(), &QgsProject::transformContextChanged,
this, [ = ]
{
mSettings.setTransformContext( QgsProject::instance()->transformContext() );
emit transformContextChanged();
refresh();
} );
}

// refresh canvas when a remote svg/image has finished downloading
connect( QgsApplication::svgCache(), &QgsSvgCache::remoteSvgFetched, this, &QgsMapCanvas::redrawAllLayers );
Expand Down Expand Up @@ -221,8 +225,7 @@ QgsMapCanvas::QgsMapCanvas( QWidget *parent )
setTemporalRange( mSettings.temporalRange() );

refresh();

} // QgsMapCanvas ctor
}


QgsMapCanvas::~QgsMapCanvas()
Expand Down

0 comments on commit b9ef421

Please sign in to comment.