summaryrefslogtreecommitdiff
path: root/platform/ios/benchmark/MBXBenchViewController.mm
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2017-11-08 17:14:26 -0800
committerChris Loer <chris.loer@gmail.com>2017-11-08 17:14:46 -0800
commit5a9dcc48bbf60638fc22c49489a04046511e1c05 (patch)
tree66c8b9c9650a719bca6c82851da5bd2f638fe241 /platform/ios/benchmark/MBXBenchViewController.mm
parenta2bcef5d1cf9a8acc4a4772329c6dc80c9b1e077 (diff)
downloadqtlocation-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/benchmark/MBXBenchViewController.mm')
-rw-r--r--platform/ios/benchmark/MBXBenchViewController.mm24
1 files changed, 21 insertions, 3 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);