summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2019-07-18 18:25:58 -0400
committerJulian Rex <julian.rex@mapbox.com>2019-07-22 11:02:53 -0400
commit4f2cc3a66570b7586e5fafd7e995a76842f17bfc (patch)
tree2c7a507dc52928e9341d59644e22674947ccb9d5
parentdabf5d0c3a76f9fbe8b866f64f51accf12d1a2a6 (diff)
downloadqtlocation-mapboxgl-4f2cc3a66570b7586e5fafd7e995a76842f17bfc.tar.gz
[ios] Profiling test for querying road features
-rw-r--r--platform/ios/app/MBXViewController.m45
-rw-r--r--platform/ios/ios.xcodeproj/project.pbxproj6
2 files changed, 50 insertions, 1 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 2fb95e1b17..2c9e230ad6 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 },
@@ -850,7 +865,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;
+ }];
+
});
}
});
@@ -2047,6 +2077,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 5f0d29a5e7..81fb0f0b84 100644
--- a/platform/ios/ios.xcodeproj/project.pbxproj
+++ b/platform/ios/ios.xcodeproj/project.pbxproj
@@ -3947,6 +3947,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";
@@ -3985,6 +3986,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)",
@@ -4299,6 +4301,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";
@@ -4313,6 +4316,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";
@@ -4398,6 +4402,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)",
@@ -4446,6 +4451,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)",