Skip to content
Permalink
Browse files

Some wms provider profiling

  • Loading branch information
nyalldawson committed Jun 28, 2020
1 parent e8a15c1 commit 41c91bb0f08b351087dd711d6c1e958ff8baeb4f
Showing with 20 additions and 0 deletions.
  1. +5 −0 src/core/raster/qgsrasterlayer.cpp
  2. +15 −0 src/providers/wms/qgswmsprovider.cpp
@@ -54,6 +54,7 @@ email : tim at linfiniti.com
#include "qgsbilinearrasterresampler.h"
#include "qgscubicrasterresampler.h"
#include "qgsrasterlayertemporalproperties.h"
#include "qgsruntimeprofiler.h"

#include <cmath>
#include <cstdio>
@@ -622,6 +623,10 @@ void QgsRasterLayer::setDataProvider( QString const &provider, const QgsDataProv

//mBandCount = 0;

std::unique_ptr< QgsScopedRuntimeProfile > profile;
if ( QgsApplication::profiler()->groupIsActive( QStringLiteral( "projectload" ) ) )
profile = qgis::make_unique< QgsScopedRuntimeProfile >( tr( "Create %1 provider" ).arg( provider ), QStringLiteral( "projectload" ) );

mDataProvider = qobject_cast< QgsRasterDataProvider * >( QgsProviderRegistry::instance()->createProvider( mProviderKey, mDataSource, options ) );
if ( !mDataProvider )
{
@@ -50,6 +50,7 @@
#include "qgssettings.h"
#include "qgsogrutils.h"
#include "qgsproviderregistry.h"
#include "qgsruntimeprofiler.h"

#include <QNetworkRequest>
#include <QNetworkReply>
@@ -122,8 +123,13 @@ QgsWmsProvider::QgsWmsProvider( QString const &uri, const ProviderOptions &optio
if ( !addLayers() )
return;

std::unique_ptr< QgsScopedRuntimeProfile > profile;

if ( mSettings.mIsMBTiles )
{
if ( QgsApplication::profiler()->groupIsActive( QStringLiteral( "projectload" ) ) )
profile = qgis::make_unique< QgsScopedRuntimeProfile >( tr( "Setup tile capabilities" ), QStringLiteral( "projectload" ) );

// we are dealing with a local MBTiles file
if ( !setupMBTilesCapabilities( uri ) )
{
@@ -133,6 +139,9 @@ QgsWmsProvider::QgsWmsProvider( QString const &uri, const ProviderOptions &optio
}
else if ( mSettings.mXyz )
{
if ( QgsApplication::profiler()->groupIsActive( QStringLiteral( "projectload" ) ) )
profile = qgis::make_unique< QgsScopedRuntimeProfile >( tr( "Setup tile capabilities" ), QStringLiteral( "projectload" ) );

// we are working with XYZ tiles
// no need to get capabilities, the whole definition is in URI
// so we just generate a dummy WMTS definition
@@ -146,6 +155,9 @@ QgsWmsProvider::QgsWmsProvider( QString const &uri, const ProviderOptions &optio
if ( capabilities )
mCaps = *capabilities;

if ( QgsApplication::profiler()->groupIsActive( QStringLiteral( "projectload" ) ) )
profile = qgis::make_unique< QgsScopedRuntimeProfile >( tr( "Retrieve server capabilities" ), QStringLiteral( "projectload" ) );

// Make sure we have capabilities - other functions here may need them
if ( !retrieveServerCapabilities() )
{
@@ -176,6 +188,9 @@ QgsWmsProvider::QgsWmsProvider( QString const &uri, const ProviderOptions &optio
}
mCrs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( mSettings.mCrsId );

if ( profile )
profile->switchTask( tr( "Calculate extent" ) );

if ( !calculateExtent() || mLayerExtent.isEmpty() )
{
appendError( ERR( tr( "Cannot calculate extent" ) ) );

0 comments on commit 41c91bb

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