Question 6

From BA3 Mapping Engine Wiki
Jump to: navigation, search

Question 6 - How much of the CPU is used by the BA3 Mapping Engine? Why is there CPU utilization even when the engine should be idle?

Similar to a game engine (and most other state-of-the art map renderers out for iOS and Android), the BA3 Mapping Engine is designed to display a fluid animation when panning, zooming, fading in/out markers, or animating vector markers like the animated circle or animated reticle. By default it tries to run at a consistent 60 frames per second.

When nothing is displayed (blank screen), the Mapping Engine is still running through its main processing loop, checking to see if there is work, and then clearing and filling the screen with the current fill color. It going to try to do this 60 times per second. This can take CPU and GPU time, but it will be minimal because there is little to do.

Much more typical is the case where work needs to be done because of panning, zooming, on-screen animations, change in GPS coordinates, etc. The architecture of the engine is such that in its main update loop, it tries to do a ‘reasonable’ amount of work and exit the loop to allow the rest of the application and the operating system to do work. This loop is driven by a displayLink timer object that is part of the GLKViewController system on iOS. As such, the target frame-rate can be adjusted by changing the preferredFramesPerSecond setting to a lower number. This can potentially free up CPU and GPU time. This setting can be dynamically adjusted by the application based on the current scenario or demands from the user. However, if you set it too low, it is possible that animations will be less fluid and the illusion of smooth animation will be lost.

The application may also simply pause the mapping engine and it will not update at all. This could be needed, for example, if the application wanted to support some type of hibernate mode, to conserve battery power, or to free up the CPU to perform some other work.

Our reference application for iOS, for example, pauses the mapping engine when it is downloading maps.

Somewhat counter-intuitively, when the mapping engine begins requesting tiles from tile providers and determines that it is ‘waiting’ on something else (this can be adjusted by changing the maxTilesInFlight setting BTW) it is possible it sometimes appear that the Mapping Engine is doing less CPU work. And this will vary whether you are looking at CPU usage on the simulator or hardware.

If you are not displaying any high-frequency animations (circle, reticle) and you know the user isn’t interacting with the display, or you are doing low-frequency animations (like animated weather), you can drop the perferredFramesPerSecond down to something lower than 60, which will reduce CPU load.

It is possible for us to implement the logic in the engine to try to detect if it can auto-throttle down to conserve CPU power and we have discussed it internally. But a few simple tests running without any throttling have shown that the amount of battery power savings may not be very high. The optimization work already done in the main update loop makes the engine quite efficient.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox