Trepn plug-in for Eclipse FAQ Introduction and Technical Problem Q: What is Trepn plug-in for Eclipse? A: The Trepn plug-in for Eclipse is a power profiling tool created by Qualcomm Technologies Inc. for Android app developers, designed to enable them to optimize their apps for lower power consumption. Unlike traditional tools, this plug-in is designed to allow you to easily collect performance data from any app running on a mobile device, analyze the resulting graphs in the Eclipse IDE and modify your code to build power-efficient apps. Q: Who needs the Trepn plug-in? A: Android developers can use this plug-in to find areas in which their apps are consuming power unnecessarily. Since this software runs entirely in Eclipse, once you have identified power-consumption problems, you can easily examine and modify your code. Q: Why do apps consume power unnecessarily? How is that a problem? A: Most apps are not designed for power-efficiency. They may neglect to run hardware resources on the device in power-saving mode or to switch off those resources when not in use. Some apps transmit and receive data constantly without allowing the radio to return to its dormant state efficiently. Other apps prevent the device from going to sleep normally. Users notice apps that drain the battery needlessly because it makes for a poor user experience. They give these apps low ratings, which can lead to poor download rates. Q: What is the difference between Trepn Profiler and the Trepn plug-in for Eclipse? A: Trepn Profiler is the on-device tool that runs on Android devices. It profiles in real time how a mobile app uses CPU, network and hardware resources, and then displays usage on the device in both real-time gauges and historical graphs. The Trepn plug-in for Eclipse goes one big step further by controlling Trepn from a computer and allowing off-device analysis. In an Eclipse perspective, the plug-in charts the data from the device. You can study the charts in Eclipse and easily modify your code to resolve power consumption problems. Q: How do I install the plug-in? A: See the instructions at [insert link to instruction page], then install the plug-in from inside Eclipse. The package adds the plug-in to Eclipse, and the plug-in pushes an APK to the USB-connected device. See the Trepn plug-in for Eclipse Installation Guide for more details. Q: How does the plug-in work? A: From the Trepn Control tab in the plug-in, you start and stop Trepn Profiler on the device. After profiling, the plug-in pulls the data from the device and plots it in charts within Eclipse, which you can then analyze.
Q: What is a use case for this plug-in? A: A developer discovers, for example, that a game drains battery even when powered off. Using Trepn, the developer sees the CPU never sleeps after the game is installed because the app doesn t release wakelocks when the application stops. Once the problem is pinpointed, the developer can iterate and profile the game with modified code to alleviate the power consumption issue. Q: What are some of the advantages of Trepn plug-in over other products? A: The Trepn plug-in for Eclipse has several advantages: It runs on a broad range of commercial Android devices (Android 2.3 and higher) It helps you identify resource bottlenecks in your app and find the areas of your code you need to modify It s fully integrated with Eclipse and fits in with the workflow of app development. It s easier. You don t need to root your test device or solder leads to a circuit board It s available at no cost Product Q: What are the system requirements for this plug-in? A: A computer running Eclipse (v3.4 Ganymede or later; Windows 32/64, Mac OS X and Linux) with the Android Development Tools (ADT) Plugin. Either install the ADT Bundle, which includes Eclipse, or install just the ADT plug-in, if Eclipse is already installed. An Android device (see list of supported devices) A micro-usb to USB cable Q: Which devices does the Trepn plug-in support? A: This plug-in runs on devices with Android 2.3 (Gingerbread) or higher. Tested devices which support all Trepn features: Snapdragon 800 (8974) MDP/T Snapdragon 800 (8974) MDP/S Snapdragon 600 (8064) MDP/T Snapdragon S4 Pro (8960) MDP/S Google/ASUS Nexus 7 LG Nexus 4 HTC One (2013) Sony Xperia ZL HTC Droid DNA LG Optimus G Pro More devices to be added
Tested devices which support all features except battery power: Samsung Galaxy S III (Qualcomm version) Samsung Galaxy S4 (Qualcomm version) Devices with known issues: HTC One - Normalized CPU Load appears as zero Q: Do you plan to release a version of this plug-in for Android Studio? A: We are considering this for a future release. Q: Why is normalized CPU load always zero on the HTC One? A: The HTC One is missing files required to calculate this value. Q: How can I submit bugs or feature requests for the plug-in? A: Contact us at trepnfeedback@qti.qualcomm.com. Q: How can I get Trepn plug-in for Eclipse? A: Download the plug-in from the Qualcomm Developer Network at developer.qualcomm.com System Resources Q: Which system resources can I chart with the Trepn plug-in for Eclipse? A: Depending on the test device, Trepn can chart: Power usage at the battery (see list of supported devices) CPU usage GPU usage Display brightness Wakelocks Bluetooth state GPS state Mobile network state Mobile data usage (by app) Wi-Fi state Wi-Fi data usage (by app) WifiLocks
Q: Why are wakelocks important? How can I keep the display illuminated without using them? A: According to the Android API Reference, wakelocks are a mechanism to indicate that your application needs to have the device stay on...device battery life will be significantly affected by the use of this API. Do not acquire PowerManager.WakeLocks unless you really need them, use the minimum levels possible, and be sure to release them as soon as possible. An app may use wakelocks to keep the CPU running for a given task, but if not released, they prevent the device from going to sleep and can quickly drain the battery. Instead of a wakelock, most applications should use FLAG_KEEP_SCREEN_ON... It will be correctly managed by the platform as the user moves between applications, and it doesn't require special permission. Q: How can I use this plug-in to chart mobile network states? A: Click on the right-arrow on the Trepn Control to start profiling (or start profiling without Wakelocks). Run the test app on the device, then return to Eclipse and click Stop profiling. Click Retrieve Latest Trepn Datafile. The resulting chart shows four different states: transmitting, idle, dormant and disconnected.
Q: How can I use this plug-in to chart socket usage? A: The procedure is similar to the one for charting mobile network states. Click Start profiling from the Control tab in Eclipse. On the device, run the test app, then return to Eclipse and click Stop profiling. Click Retrieve Latest Trepn Datafile. The resulting mobile data usage chart shows the volume of traffic based on apps (e.g., social, maps, location). Mousing over the chart shows detailed statistics. Q: Can I create my own chart? A: Yes. In Edit Custom Charts, you can select state names and corresponding logcat values. Trepn then graphs the values against their occurrences in the logcat and displays the resulting custom chart. Q: How can I increase the power-efficiency of my app? A: Using the charts generated by Trepn plug-in, you can identify several kinds of power problems in your app and modify your code in Eclipse to address them. For example: Group network traffic together by scheduling multiple transmit or receive requests at once. Ungrouped network activity drains the battery faster than grouped activity. Close network sockets as soon as the app is finished with them. Otherwise, the server has to send a TCP close packet, which wakes the radio and consumes additional power Use wakelocks sparingly, at the lowest level possible, and release them as soon as possible. Wakelocks keep the CPU running needlessly, draining the battery Avoid polling and using keep-alives to maintain a persistent network connection. They wake the modem frequently, which uses extra power Turn off the GPS when not in use and use precise location only when necessary Q: Why does the mobile network state appear incorrect? A: Data charted for Mobile Network State may be invalid when the screen is off.. To profile accurately, keep the display by increasing the display timeout. Q: Why do I see no data charted for WakeLocks or WifiLocks? A: WakeLock and WifiLock data is unavailable when the device is connected via USB. After you disconnect the device being profiled from the computer, wakelock data will be available. Q: Why does my battery power chart look incorrect? A: Battery Power is most accurate when you disconnect the device from the computer so that the battery is not charging. To allow the system to sleep normally, click Start profiling instead of Start profiling with wakelocks.
Q: What s the difference between "Start profiling" and "Start profiling with wakelocks?" A: "Start Profiling with wakelocks" will start the profiling session by first obtaining a wakelock, which prevents the device from going to sleep. Since data will not be gathered when the device is asleep, use "Start Profiling with wakelocks" to prevent the device from sleeping so that data is always captured. However, for more meaningful Battery Power values, use "Start Profiling" instead. 2013 Qualcomm Technologies, Inc. All rights reserved. Qualcomm is a registered trademark of Qualcomm Incorporated, registered in the United States and other countries. Trademarks of Qualcomm Incorporated are used with permission. Other products and brand names may be trademarks or registered trademarks of their respective owners.