Cellular purposes can behave in a different way between emulator and system and, as an app grows increasingly more advanced, debugging efficiency bottlenecks can develop into extraordinarily tough. The GPA System Analyzer, a part of the Intel® INDE, is a instrument that may assist diagnose a wide range of efficiency points.
Putting in Intel® Built-in Native Developer Expertise beta (Intel® INDE)
Intel INDE gives an entire and constant set of C++/Java* instruments, libraries & samples for surroundings setup, code creation, compilation, debugging and evaluation on Intel® architecture-based units and choose capabilities on ARM*-based Android* units.
Set up Intel INDE from right here:
Constructing Your App for Distant Debugging
To permit the GPA System Analyzer to connect with your app, you must make sure that it has INTERNET permission and that debuggable is ready to “true.”
Understanding the App
The Artwork Browser pattern app is a bare-bones pattern that encapsulates sure points of bigger real-world purposes. It?s an very simple picture carousel, equivalent to you would possibly discover in a media participant or image searching app. It has two buttons that you wouldn’t discover in a manufacturing software, that are helpful for recreating widespread efficiency points:
- A button for enabling and disabling “Advanced Math Calculations.” This simulates real-world conditions the place you have got a selection to make use of superior, CPU-intensive physics engines, extraordinarily verbose logging, heavy responsibility bitmap results, or any variety of different CPU-intensive options that aren?t vital for the success of the app. The button, in its enabled state will sluggish the app considerably by overloading the CPU, which then provides us a possibility to see learn how to debug CPU-bound apps. The button is disabled by default to permit the app to load easily.
- A dropdown for selecting geometry complexity. It may well typically be useful to subdivide giant planes into grids of smaller tiles to keep away from depth-sorting points. The default worth is a 128×128 grid, which is extra advanced than vital however will assist illustrate our factors. Geometry this advanced will overload the GPU and provides us an opportunity to see what a GPU-bound app seems like in GPA. Decreasing it to any of the decrease values will trigger the app to run smoother.
Connecting to Your App
Construct and set up the Artwork Browser pattern app in your system or emulator. Then be certain that your Android improvement instrument (Eclipse, and many others.) will not be operating, as it will trigger issues connecting to your app. Begin the GPA System Analyzer instrument. It should record your native machine, in addition to any operating emulators or hooked up units.
Ensure that your system or emulator is unlocked and USB Debugging is enabled. Click on the “Connect” button to connect with it. GPA will present a listing of all debugging-enabled apps.
GPA has a wealthy number of information it may possibly monitor, however for this app we?ll be most within the body price and CPU load. Drag CPU ? Aggregated CPU Load from the left sidebar into the higher graph and drag OpenGL ? FPS into the decrease graph.
To reveal a CPU-bound scenario, we?ll must allow our Complicated Math Calculation through the button within the app. We will instantly see that it’s consuming 100% of the processor. This explains the body price of close to zero FPS. Clicking the button once more to show off the heavy-duty math improves the scenario a bit, bringing the aggregated CPU load under 30% and elevating our FPS to a marginally-usable 10.
We?ve disabled the one CPU-intensive items of code, however our efficiency continues to be comparatively poor. Our solely possibility now’s to optimize the OpenGL rendering. Graphics bottlenecks could be harder to untangle than CPU bottlenecks, for the reason that OpenGL graphics pipeline is a fancy course of, and there may be not at all times a single metric that can reveal an issue. Happily, GPA comes with a wealthy set of OpenGL optimizing instruments which encompass checkboxes that flip or change totally different off elements of the OpenGL rendering pipeline.
The simplest option to decide in case your app is GPU-bound with an OpenGL bottleneck is to make use of the Disable Draw Calls state override. This may flip off any operations which have been despatched to the GPU. If utilizing this override doesn?t enhance efficiency, we all know our downside is CPU-related. Nonetheless, if FPS climbs considerably, we positively have an OpenGL bottleneck.
As you possibly can see, the FPS graph shot up in consequence, so we all know our app is GPU-bound. We will see if maybe our high-resolution textures are inflicting a difficulty by disabling all state overrides after which utilizing the Texture 2×2 override.
This effected little change. We will then attempt utilizing the Easy Fragment Shader override to see if our shader code is simply too advanced.
Once more, not the beneficial properties we had been searching for. We will check for overly-complex geometry by evaluating the TA Load metric with USSE Vertex Load metric. Drag the GPU ? TA Load metric to the highest graph, then maintain CTRL and drag the GPU ? USSE Vertex Load metric to the highest graph as effectively, to let it graph beside the TA Load. Considerably reverse of what you could be anticipating, a excessive TA Load with a low Vertex Load signifies too many vertices are being processed.
Clearly this is a matter, since TA Load is an order of magnitude larger. Nonetheless, discover that it?s nonetheless hovering below 50%. It?s price noting once more that even extreme graphics bottlenecks could not ship anyone metric to 100%.
Utilizing the Geometry Complexity spinner in our app, we will simplify our geometry to a 2×2 grid.
This offers us an instantaneous FPS increase, and TA Load turns into extra balanced with USSE Vertex Load. We will additionally attempt 8×8 and 32×32 if we wish to discover the candy spot between efficiency and depth sorting. Now, the app is prepared for primetime!
Observe: The applying is examined and the outcomes are analyzed on Intel Atom processor Z2760 tablets.
Though efficiency points could be tough to debug on commercial-scale apps, the GPA System Analyzer generally is a enormous asset in investigating advanced efficiency bottlenecks. For extra info and full documentation, take a look at the GPA System Analyzer homepage on Intel.com.
For extra such Android assets and instruments from Intel, please go to the Intel® Developer Zone