diff options
author | Julian Rex <julian.rex@mapbox.com> | 2019-07-18 18:25:58 -0400 |
---|---|---|
committer | Julian Rex <julian.rex@mapbox.com> | 2019-08-23 16:20:53 -0400 |
commit | e516dd45dc784fe36274c101ed32a96d46e7674f (patch) | |
tree | 6e3ce60633440b6d17433b0fb3293cc99e095c41 | |
parent | 5c22f3f236c68385e09b4ea0495badd947404480 (diff) | |
download | qtlocation-mapboxgl-e516dd45dc784fe36274c101ed32a96d46e7674f.tar.gz |
[ios] Profiling test for querying road features
-rw-r--r-- | platform/ios/app/MBXViewController.m | 45 | ||||
-rw-r--r-- | platform/ios/ios.xcodeproj/project.pbxproj | 6 |
2 files changed, 50 insertions, 1 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 346a182a88..e6b7170251 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -17,6 +17,21 @@ #import "../src/MGLMapView_Experimental.h" #import <objc/runtime.h> +#import <os/log.h> +#import <os/signpost.h> + +os_log_t signpostlog; +os_signpost_id_t signpost; +BOOL queryForRoads = NO; + +@interface MGLStyle (qrf) +@property (nonatomic, readonly, copy) NSArray<MGLVectorStyleLayer *> *roadStyleLayers; +@end + +@interface MGLMapView () +- (void)setNeedsRerender; +@end + static const CLLocationCoordinate2D WorldTourDestinations[] = { { .latitude = 38.8999418, .longitude = -77.033996 }, @@ -830,7 +845,22 @@ CLLocationCoordinate2D randomWorldCoordinate() { dispatch_async(dispatch_get_main_queue(), ^ { [self.mapView addAnnotations:annotations]; - [self.mapView showAnnotations:annotations animated:YES]; + + signpostlog = os_log_create("com.mapbox.iosapp", "qrf"); + signpost = os_signpost_id_generate(signpostlog); + + +// [self.mapView showAnnotations:annotations animated:YES]; + + os_signpost_interval_begin(signpostlog, signpost, "show-annotations"); + [self.mapView showAnnotations:annotations edgePadding:UIEdgeInsetsZero animated:YES completionHandler:^{ + os_signpost_interval_end(signpostlog, signpost, "show-annotations"); + + // Idle till after all tile parsing/rendering is done (don't want a busy CPU) + [self.mapView setNeedsRerender]; + queryForRoads = YES; + }]; + }); } }); @@ -1996,6 +2026,19 @@ CLLocationCoordinate2D randomWorldCoordinate() { #pragma mark - MGLMapViewDelegate +- (void)mapViewDidBecomeIdle:(MGLMapView *)mapView +{ + if (queryForRoads) + { + os_signpost_interval_begin(signpostlog, signpost, "query-roads"); + NSArray *roadStyleLayerIdentifiers = [self.mapView.style.roadStyleLayers valueForKey:@"identifier"]; + NSArray *visibleRoadFeatures = [self.mapView visibleFeaturesInRect:self.mapView.bounds inStyleLayersWithIdentifiers:[NSSet setWithArray:roadStyleLayerIdentifiers]]; + os_signpost_interval_end(signpostlog, signpost, "query-roads"); + os_signpost_event_emit(signpostlog, signpost, "query-roads-count", "%ld", visibleRoadFeatures.count); + queryForRoads = YES; + } +} + - (MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id<MGLAnnotation>)annotation { if (annotation == mapView.userLocation) diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 5a5cb00b49..fc437084b8 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -3951,6 +3951,7 @@ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO; DEVELOPMENT_TEAM = GJZR2MEM28; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = "Mapbox GL"; @@ -3989,6 +3990,7 @@ ); INFOPLIST_FILE = framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", @@ -4303,6 +4305,7 @@ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO; DEVELOPMENT_TEAM = GJZR2MEM28; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = "Mapbox GL"; @@ -4317,6 +4320,7 @@ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO; DEVELOPMENT_TEAM = GJZR2MEM28; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = "Mapbox GL"; @@ -4402,6 +4406,7 @@ ); INFOPLIST_FILE = framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", @@ -4450,6 +4455,7 @@ ); INFOPLIST_FILE = framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", |