08.06.2015 Views

Trepn™ plug-in for Eclipse™ FAQ

Trepn™ plug-in for Eclipse™ FAQ

Trepn™ plug-in for Eclipse™ FAQ

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Trepn <strong>plug</strong>-<strong>in</strong> <strong>for</strong> Eclipse <strong>FAQ</strong><br />

Introduction and Technical Problem<br />

Q: What is Trepn <strong>plug</strong>-<strong>in</strong> <strong>for</strong> Eclipse?<br />

A: The Trepn <strong>plug</strong>-<strong>in</strong> <strong>for</strong> Eclipse is a power profil<strong>in</strong>g tool created by Qualcomm Technologies Inc. <strong>for</strong><br />

Android app developers, designed to enable them to optimize their apps <strong>for</strong> lower power consumption.<br />

Unlike traditional tools, this <strong>plug</strong>-<strong>in</strong> is designed to allow you to easily collect per<strong>for</strong>mance data from any<br />

app runn<strong>in</strong>g on a mobile device, analyze the result<strong>in</strong>g graphs <strong>in</strong> the Eclipse IDE and modify your code to<br />

build power-efficient apps.<br />

Q: Who needs the Trepn <strong>plug</strong>-<strong>in</strong>?<br />

A: Android developers can use this <strong>plug</strong>-<strong>in</strong> to f<strong>in</strong>d areas <strong>in</strong> which their apps are consum<strong>in</strong>g power<br />

unnecessarily. S<strong>in</strong>ce this software runs entirely <strong>in</strong> Eclipse, once you have identified power-consumption<br />

problems, you can easily exam<strong>in</strong>e and modify your code.<br />

Q: Why do apps consume power unnecessarily? How is that a problem?<br />

A: Most apps are not designed <strong>for</strong> power-efficiency. They may neglect to run hardware resources on the<br />

device <strong>in</strong> power-sav<strong>in</strong>g mode or to switch off those resources when not <strong>in</strong> use. Some apps transmit and<br />

receive data constantly without allow<strong>in</strong>g the radio to return to its dormant state efficiently. Other apps<br />

prevent the device from go<strong>in</strong>g to sleep normally.<br />

Users notice apps that dra<strong>in</strong> the battery needlessly because it makes <strong>for</strong> a poor user experience. They<br />

give these apps low rat<strong>in</strong>gs, which can lead to poor download rates.<br />

Q: What is the difference between Trepn Profiler and the Trepn <strong>plug</strong>-<strong>in</strong> <strong>for</strong> Eclipse?<br />

A: Trepn Profiler is the on-device tool that runs on Android devices. It profiles <strong>in</strong> real time how a mobile<br />

app uses CPU, network and hardware resources, and then displays usage on the device <strong>in</strong> both real-time<br />

gauges and historical graphs.<br />

The Trepn <strong>plug</strong>-<strong>in</strong> <strong>for</strong> Eclipse goes one big step further by controll<strong>in</strong>g Trepn from a computer and<br />

allow<strong>in</strong>g off-device analysis. In an Eclipse perspective, the <strong>plug</strong>-<strong>in</strong> charts the data from the device. You<br />

can study the charts <strong>in</strong> Eclipse and easily modify your code to resolve power consumption problems.<br />

Q: How do I <strong>in</strong>stall the <strong>plug</strong>-<strong>in</strong>?<br />

A: See the <strong>in</strong>structions at [<strong>in</strong>sert l<strong>in</strong>k to <strong>in</strong>struction page], then <strong>in</strong>stall the <strong>plug</strong>-<strong>in</strong> from <strong>in</strong>side Eclipse. The<br />

package adds the <strong>plug</strong>-<strong>in</strong> to Eclipse, and the <strong>plug</strong>-<strong>in</strong> pushes an APK to the USB-connected device. See the<br />

Trepn <strong>plug</strong>-<strong>in</strong> <strong>for</strong> Eclipse Installation Guide <strong>for</strong> more details.<br />

Q: How does the <strong>plug</strong>-<strong>in</strong> work?<br />

A: From the Trepn Control tab <strong>in</strong> the <strong>plug</strong>-<strong>in</strong>, you start and stop Trepn Profiler on the device. After<br />

profil<strong>in</strong>g, the <strong>plug</strong>-<strong>in</strong> pulls the data from the device and plots it <strong>in</strong> charts with<strong>in</strong> Eclipse, which you can<br />

then analyze.


Q: What is a use case <strong>for</strong> this <strong>plug</strong>-<strong>in</strong>?<br />

A: A developer discovers, <strong>for</strong> example, that a game dra<strong>in</strong>s battery even when powered off. Us<strong>in</strong>g Trepn,<br />

the developer sees the CPU never sleeps after the game is <strong>in</strong>stalled because the app doesn’t release<br />

wakelocks when the application stops. Once the problem is p<strong>in</strong>po<strong>in</strong>ted, the developer can iterate and<br />

profile the game with modified code to alleviate the power consumption issue.<br />

Q: What are some of the advantages of Trepn <strong>plug</strong>-<strong>in</strong> over other products?<br />

A: The Trepn <strong>plug</strong>-<strong>in</strong> <strong>for</strong> Eclipse has several advantages:<br />

• It runs on a broad range of commercial Android devices (Android 2.3 and higher)<br />

• It helps you identify resource bottlenecks <strong>in</strong> your app and f<strong>in</strong>d the areas of your code you need<br />

to modify<br />

• It’s fully <strong>in</strong>tegrated with Eclipse and fits <strong>in</strong> with the workflow of app development.<br />

• It’s easier. You don’t need to root your test device or solder leads to a circuit board<br />

• It’s available at no cost<br />

Product<br />

Q: What are the system requirements <strong>for</strong> this <strong>plug</strong>-<strong>in</strong>?<br />

A: A computer runn<strong>in</strong>g Eclipse (v3.4 Ganymede or later; W<strong>in</strong>dows 32/64, Mac OS X and L<strong>in</strong>ux) with the<br />

Android Development Tools (ADT) Plug<strong>in</strong>. Either <strong>in</strong>stall the ADT Bundle, which <strong>in</strong>cludes Eclipse, or <strong>in</strong>stall<br />

just the ADT <strong>plug</strong>-<strong>in</strong>, if Eclipse is already <strong>in</strong>stalled.<br />

• An Android device (see list of supported devices)<br />

• A micro-USB to USB cable<br />

Q: Which devices does the Trepn <strong>plug</strong>-<strong>in</strong> support?<br />

A: This <strong>plug</strong>-<strong>in</strong> runs on devices with Android 2.3 (G<strong>in</strong>gerbread) or higher.<br />

Tested devices which support all Trepn features:<br />

• Snapdragon 800 (8974) MDP/T<br />

• Snapdragon 800 (8974) MDP/S<br />

• Snapdragon 600 (8064) MDP/T<br />

• Snapdragon S4 Pro (8960) MDP/S<br />

• Google/ASUS Nexus 7<br />

• LG Nexus 4<br />

• HTC One (2013)<br />

• Sony Xperia ZL<br />

• HTC Droid DNA<br />

• LG Optimus G Pro<br />

• More devices to be added


Tested devices which support all features except battery power:<br />

• Samsung Galaxy S III (Qualcomm version)<br />

• Samsung Galaxy S4 (Qualcomm version)<br />

Devices with known issues:<br />

• HTC One - Normalized CPU Load appears as zero<br />

Q: Do you plan to release a version of this <strong>plug</strong>-<strong>in</strong> <strong>for</strong> Android Studio?<br />

A: We are consider<strong>in</strong>g this <strong>for</strong> a future release.<br />

Q: Why is normalized CPU load always zero on the HTC One?<br />

A: The HTC One is miss<strong>in</strong>g files required to calculate this value.<br />

Q: How can I submit bugs or feature requests <strong>for</strong> the <strong>plug</strong>-<strong>in</strong>?<br />

A: Contact us at trepnfeedback@qti.qualcomm.com.<br />

Q: How can I get Trepn <strong>plug</strong>-<strong>in</strong> <strong>for</strong> Eclipse?<br />

A: Download the <strong>plug</strong>-<strong>in</strong> from the Qualcomm Developer Network at developer.qualcomm.com<br />

System Resources<br />

Q: Which system resources can I chart with the Trepn <strong>plug</strong>-<strong>in</strong> <strong>for</strong> Eclipse?<br />

A: Depend<strong>in</strong>g on the test device, Trepn can chart:<br />

• Power usage at the battery (see list of supported devices)<br />

• CPU usage<br />

• GPU usage<br />

• Display brightness<br />

• Wakelocks<br />

• Bluetooth state<br />

• GPS state<br />

• Mobile network state<br />

• Mobile data usage (by app)<br />

• Wi-Fi state<br />

• Wi-Fi data usage (by app)<br />

• WifiLocks


Q: Why are wakelocks important? How can I keep the display illum<strong>in</strong>ated without us<strong>in</strong>g them?<br />

A: Accord<strong>in</strong>g to the Android API Reference, wakelocks are “a mechanism to <strong>in</strong>dicate that your<br />

application needs to have the device stay on...Device battery life will be significantly affected by the<br />

use of this API. Do not acquire PowerManager.WakeLocks unless you really need them, use the<br />

m<strong>in</strong>imum levels possible, and be sure to release them as soon as possible.” An app may use wakelocks<br />

to keep the CPU runn<strong>in</strong>g <strong>for</strong> a given task, but if not released, they prevent the device from go<strong>in</strong>g to sleep<br />

and can quickly dra<strong>in</strong> the battery.<br />

Instead of a wakelock, “most applications should use FLAG_KEEP_SCREEN_ON . . . It will be correctly<br />

managed by the plat<strong>for</strong>m as the user moves between applications, and it doesn't require special<br />

permission.”<br />

Q: How can I use this <strong>plug</strong>-<strong>in</strong> to chart mobile network states?<br />

A: Click on the right-arrow on the Trepn Control to start profil<strong>in</strong>g (or start profil<strong>in</strong>g without Wakelocks).<br />

Run the test app on the device, then return to Eclipse and click “Stop profil<strong>in</strong>g”. Click “Retrieve Latest<br />

Trepn Datafile.” The result<strong>in</strong>g chart shows four different states: transmitt<strong>in</strong>g, idle, dormant and<br />

disconnected.


Q: How can I use this <strong>plug</strong>-<strong>in</strong> to chart socket usage?<br />

A: The procedure is similar to the one <strong>for</strong> chart<strong>in</strong>g mobile network states. Click “Start profil<strong>in</strong>g” from the<br />

Control tab <strong>in</strong> Eclipse. On the device, run the test app, then return to Eclipse and click “Stop profil<strong>in</strong>g.”<br />

Click “Retrieve Latest Trepn Datafile.” The result<strong>in</strong>g mobile data usage chart shows the volume of traffic<br />

based on apps (e.g., social, maps, location). Mous<strong>in</strong>g over the chart shows detailed statistics.<br />

Q: Can I create my own chart?<br />

A: Yes. In Edit Custom Charts, you can select state names and correspond<strong>in</strong>g logcat values. Trepn then<br />

graphs the values aga<strong>in</strong>st their occurrences <strong>in</strong> the logcat and displays the result<strong>in</strong>g custom chart.<br />

Q: How can I <strong>in</strong>crease the power-efficiency of my app?<br />

A: Us<strong>in</strong>g the charts generated by Trepn <strong>plug</strong>-<strong>in</strong>, you can identify several k<strong>in</strong>ds of power problems <strong>in</strong> your<br />

app and modify your code <strong>in</strong> Eclipse to address them. For example:<br />

• Group network traffic together by schedul<strong>in</strong>g multiple transmit or receive requests at once.<br />

Ungrouped network activity dra<strong>in</strong>s the battery faster than grouped activity.<br />

• Close network sockets as soon as the app is f<strong>in</strong>ished with them. Otherwise, the server has to<br />

send a TCP close packet, which wakes the radio and consumes additional power<br />

• Use wakelocks spar<strong>in</strong>gly, at the lowest level possible, and release them as soon as possible.<br />

Wakelocks keep the CPU runn<strong>in</strong>g needlessly, dra<strong>in</strong><strong>in</strong>g the battery<br />

• Avoid poll<strong>in</strong>g and us<strong>in</strong>g keep-alives to ma<strong>in</strong>ta<strong>in</strong> a persistent network connection. They wake the<br />

modem frequently, which uses extra power<br />

• Turn off the GPS when not <strong>in</strong> use and use precise location only when necessary<br />

Q: Why does the mobile network state appear <strong>in</strong>correct?<br />

A: Data charted <strong>for</strong> Mobile Network State may be <strong>in</strong>valid when the screen is off.. To profile accurately,<br />

keep the display by <strong>in</strong>creas<strong>in</strong>g the display timeout.<br />

Q: Why do I see no data charted <strong>for</strong> WakeLocks or WifiLocks?<br />

A: WakeLock and WifiLock data is unavailable when the device is connected via USB. After you<br />

disconnect the device be<strong>in</strong>g profiled from the computer, wakelock data will be available.<br />

Q: Why does my battery power chart look <strong>in</strong>correct?<br />

A: Battery Power is most accurate when you disconnect the device from the computer so that the<br />

battery is not charg<strong>in</strong>g. To allow the system to sleep normally, click “Start profil<strong>in</strong>g” <strong>in</strong>stead of “Start<br />

profil<strong>in</strong>g with wakelocks.”


Q: What’s the difference between "Start profil<strong>in</strong>g" and "Start profil<strong>in</strong>g with wakelocks?"<br />

A: "Start Profil<strong>in</strong>g with wakelocks" will start the profil<strong>in</strong>g session by first obta<strong>in</strong><strong>in</strong>g a wakelock, which<br />

prevents the device from go<strong>in</strong>g to sleep. S<strong>in</strong>ce data will not be gathered when the device is asleep, use<br />

"Start Profil<strong>in</strong>g with wakelocks" to prevent the device from sleep<strong>in</strong>g so that data is always captured.<br />

However, <strong>for</strong> more mean<strong>in</strong>gful Battery Power values, use "Start Profil<strong>in</strong>g" <strong>in</strong>stead.<br />

© 2013 Qualcomm Technologies, Inc. All rights reserved. Qualcomm is a registered trademark of<br />

Qualcomm Incorporated, registered <strong>in</strong> the United States and other countries. Trademarks of Qualcomm<br />

Incorporated are used with permission. Other products and brand names may be trademarks or<br />

registered trademarks of their respective owners.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!