diff options
author | Chris Loer <chris.loer@gmail.com> | 2017-11-08 17:14:26 -0800 |
---|---|---|
committer | Chris Loer <chris.loer@gmail.com> | 2017-11-08 17:14:46 -0800 |
commit | 5a9dcc48bbf60638fc22c49489a04046511e1c05 (patch) | |
tree | 66c8b9c9650a719bca6c82851da5bd2f638fe241 /platform/ios | |
parent | a2bcef5d1cf9a8acc4a4772329c6dc80c9b1e077 (diff) | |
download | qtlocation-mapboxgl-upstream/start-collision-bench.tar.gz |
Hacked together iOS benching.upstream/start-collision-bench
This commit makes the iOS Bench target render two scenes for 600 frames.
1) 10 second rotation at z13.86
2) 10 second zoom from z10-z14
renderer_impl and RenderSymbolLayer collect timing information and pipe it to std::cout
Copy the appropriate section of the console output to a CSV file and analyze away.
This commit should re-base conflict free on either start-collision or start-collision-async, but needs some adaptation for master.
[skip ci]
Diffstat (limited to 'platform/ios')
-rw-r--r-- | platform/ios/benchmark/MBXBenchViewController.mm | 24 | ||||
-rw-r--r-- | platform/ios/benchmark/locations.cpp | 18 | ||||
-rw-r--r-- | platform/ios/benchmark/locations.hpp | 3 | ||||
-rw-r--r-- | platform/ios/ios.xcodeproj/project.pbxproj | 3 |
4 files changed, 37 insertions, 11 deletions
diff --git a/platform/ios/benchmark/MBXBenchViewController.mm b/platform/ios/benchmark/MBXBenchViewController.mm index d4629e2521..4aff6164fd 100644 --- a/platform/ios/benchmark/MBXBenchViewController.mm +++ b/platform/ios/benchmark/MBXBenchViewController.mm @@ -36,8 +36,8 @@ [super viewDidLoad]; // Use a local style and local assets if they’ve been downloaded. - NSURL *tileSourceURL = [[NSBundle mainBundle] URLForResource:@"mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6" withExtension:nil subdirectory:@"tiles"]; - NSURL *url = [NSURL URLWithString:tileSourceURL ? @"asset://styles/streets-v8.json" : @"mapbox://styles/mapbox/streets-v8"]; + NSURL *tileSourceURL = [[NSBundle mainBundle] URLForResource:@"mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v7" withExtension:nil subdirectory:@"tiles"]; + NSURL *url = [NSURL URLWithString:tileSourceURL ? @"asset://styles/streets-v8.json" : @"mapbox://styles/mapbox/streets-v10"]; self.mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds styleURL:url]; self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.mapView.delegate = self; @@ -91,13 +91,19 @@ std::chrono::steady_clock::time_point started; std::vector<std::pair<std::string, double>> result; static const int warmupDuration = 20; // frames -static const int benchmarkDuration = 200; // frames +static const int benchmarkDuration = 600; // frames - (void)startBenchmarkIteration { if (mbgl::bench::locations.size() > idx) { const auto& location = mbgl::bench::locations[idx]; + [self.mapView resetPosition]; [self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(location.latitude, location.longitude) zoomLevel:location.zoom animated:NO]; + if (location.pitch) { + MGLMapCamera *camera = [MGLMapCamera cameraLookingAtCenterCoordinate:self.mapView.centerCoordinate fromDistance:self.mapView.camera.altitude pitch:location.pitch heading:location.bearing]; + [self.mapView setCamera:camera animated:NO]; + } + self.mapView.direction = location.bearing; state = State::WaitingForAssets; NSLog(@"Benchmarking \"%s\"", location.name.c_str()); @@ -151,6 +157,18 @@ static const int benchmarkDuration = 200; // frames if (frames >= warmupDuration) { frames = 0; + const auto& location = mbgl::bench::locations[idx]; + if (location.pitch) { + MGLMapCamera *camera = [MGLMapCamera cameraLookingAtCenterCoordinate:self.mapView.centerCoordinate fromDistance:self.mapView.camera.altitude pitch:location.pitch heading:location.endBearing]; + [self.mapView setCamera:camera withDuration:10 animationTimingFunction:nil]; + } else if (location.endZoom) { + [self.mapView setCenterCoordinate:self.mapView.centerCoordinate zoomLevel:location.endZoom animated:NO]; + CLLocationDistance targetAltitude = self.mapView.camera.altitude; // Yikes, why is the API making me do this? + [self.mapView setCenterCoordinate:self.mapView.centerCoordinate zoomLevel:location.zoom animated:NO]; + MGLMapCamera *camera = [MGLMapCamera cameraLookingAtCenterCoordinate:self.mapView.centerCoordinate fromDistance:targetAltitude pitch:location.pitch heading:location.endBearing]; + [self.mapView setCamera:camera withDuration:10 animationTimingFunction:nil]; + } + state = State::Benchmarking; started = std::chrono::steady_clock::now(); NSLog(@"- Benchmarking for %d frames...", benchmarkDuration); diff --git a/platform/ios/benchmark/locations.cpp b/platform/ios/benchmark/locations.cpp index 9f53877e40..7ab28e95c8 100644 --- a/platform/ios/benchmark/locations.cpp +++ b/platform/ios/benchmark/locations.cpp @@ -4,14 +4,16 @@ namespace mbgl { namespace bench { const std::vector<Location> locations = { - { "paris", 2.3411, 48.8664, 11, 0.0 }, - { "paris2", 2.3516, 48.8356, 13, 273.8 }, - { "alps", 10.6107, 46.9599, 6, 0.0 }, - { "us east", -84.3395, 36.9400, 5, 0.0 }, - { "greater la", -117.9529, 34.0259, 9, 0.0 }, - { "sf", -122.4202, 37.7625, 14, 0.0 }, - { "oakland", -122.2328, 37.8267, 12, 0.0 }, - { "germany", 9.2280, 50.9262, 6, 0.0 }, +// { "paris", 2.3411, 48.8664, 11, 0.0, 0, 0 }, +// { "paris2", 2.3516, 48.8356, 13, 273.8, 0, 0 }, +// { "alps", 10.6107, 46.9599, 6, 0.0, 0, 0 }, +// { "us east", -84.3395, 36.9400, 5, 0.0, 0, 0 }, +// { "greater la", -117.9529, 34.0259, 9, 0.0, 0, 0 }, +// { "sf", -122.4202, 37.7625, 14, 0.0, 0, 0 }, +// { "oakland", -122.2328, 37.8267, 12, 0.0, 0, 0 }, +// { "germany", 9.2280, 50.9262, 6, 0.0, 0, 0 }, + { "la pitched", -118.3133, 33.9612, 13.86, 0, 60, 180, 13.86 }, + { "la zoom", -118.3133, 33.9612, 10, 0, 0, 0, 14 } }; } diff --git a/platform/ios/benchmark/locations.hpp b/platform/ios/benchmark/locations.hpp index 1ea65d6280..9f796bfcc9 100644 --- a/platform/ios/benchmark/locations.hpp +++ b/platform/ios/benchmark/locations.hpp @@ -12,6 +12,9 @@ struct Location { const double latitude; const double zoom; const double bearing; + const double pitch; + const double endBearing; + const double endZoom; }; extern const std::vector<Location> locations; diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index a3ccc9337b..c6776d20d2 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -2082,6 +2082,7 @@ }; DABCABA71CB80692000A7C39 = { CreatedOnToolsVersion = 7.3; + DevelopmentTeam = JL7Z68ZVPL; }; }; }; @@ -3003,6 +3004,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = JL7Z68ZVPL; INFOPLIST_FILE = "$(SRCROOT)/benchmark/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -3015,6 +3017,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = JL7Z68ZVPL; INFOPLIST_FILE = "$(SRCROOT)/benchmark/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; |