Carat: An Android app detects joule-draining bugs

Michael Kassner has an Android phone, and it's a battery hog. He has found an app that should minimize his angst.

I hit the big "six-oh" this year and my eyes are letting me know it. To celebrate, I engaged in a Quixote-style quest — find a smartphone with a huge display. And, it had to be svelte, didn't want my pants falling down because of a heavy mobile.

I settled on the Samsung Infuse. At the time, its display was the "king of big." But that title came at a price.

My beloved display was consuming over 80 percent of available energy, making battery life less than tolerable. My solution was to stash replacement batteries at work, in my car, and other strategic locations. Yet, I never seemed to be at one of the caches when the battery decided it had enough.

Change of quest

There's no way I'm giving up on the display. So, I decided to alter my quest and focus on achieving energy conservation elsewhere — maybe remove an overly active app I don't absolutely need. Like the famous knight from La Mancha, I came upon many strange and wondrous things. For instance, a website featuring Carat:

"Carat is a research project that aims to detect energy bugs — app behavior that is consuming energy unnecessarily — using data collected from a community of mobile devices."

Not wanting to "tilt at windmills," I decided to investigate further. I contacted the research team behind Carat. Adam Oliner, postdoctoral scholar at UC Berkeley, was kind enough to respond on behalf of the team.

Kassner: Adam, welcome to TechRepublic, thank you for taking time between flights to chat. First, why call it Carat? Oliner: The name is a homophonic pun, the app Carat "measures joules." I accept the blame for that. Kassner: Ahh, I get it — good one. Adam, I installed Carat, and this was the first screen:

I clicked on the arrow beside one of the processes. The next screen explained how to stop the application. I followed the advice, wending my way through: Settings | Manage applications | "All" tab | BrcmBluetoothServices.

I pressed the "Force Stop" button and this popped up:

Can I say OK to this?

Oliner: We don't have information about what individual apps do, only their use of energy. If you aren't sure what an app does and are afraid to kill it, don't. Warnings like the one above are usually innocuous; software on mobile devices typically can tolerate sudden termination, such as when the battery runs out.

That said, important services could show up on the Action list and ought to be left alone. We are working to filter those out; meanwhile, users should exercise their own judgment.

Kassner: Next, I clicked on the "My Device" tab, and this screen popped up:

I thought "0" was good. Then, when I went to the screen suggested by the arrow next to "Your J-Score," Carat offered the following explanation:

So, my phone literally sucks when it comes to joules?

Oliner: A J-Score of zero isn't good, but it probably means we haven't generated a score for your device yet. It should probably say "N/A" until we have enough data for your device. Kassner: Next, I clicked on the "View Process List" (from the "My Device" tab):

It appears Carat is displaying my phone's installed apps. What do "Background process, Service, and Foreground app" mean?

Oliner: It is actually showing apps in the process list, a subset of the installed apps. The operating system provides the designations, and they reflect how the OS treats the app for scheduling and resource-allocation purposes.

Without going into detail:

  • Background processes are performing some function without presenting a user interface or accepting user input
  • Services are processes intended to run for extended periods
  • Foreground apps are the processes users explicitly interact with
Kassner: The following screen came up when I selected the arrow next to my phone model:

An explanation screen followed:

I couldn't demystify it. What are we looking at in this screen?

Oliner: One of the ways Carat looks at the data is by comparing conditional distributions, meaning the rates of battery drain under different circumstances. For example, the phone model graph you are looking at shows the distribution of drain rates for your device model (shown in gold) and the drain rates of other devices (in teal). The higher the line, the more likely that drain rate is observed.

A typical user is unlikely to take away much from this plot, but what I get from it is, as you move to the right toward higher drain rates, the gold line tends to be higher than the teal line. This suggests your device model is more likely to see higher battery drain rates than other device models.

Kassner: On my phone, neither the "Bugs" tab nor the "Hogs" tabs had anything to report. What information do those tabs provide? Oliner: An app listed under Bug Report means the app tends to be associated with increased energy use, specifically on your device. It may be your instance of the app is caught in a bad state or has a bad configuration. Restarting the app may help if it's a transient problem, but, if not, you may need to close and avoid the app.

An app listed under Hog Report means the app tends to be associated with increased energy use across all clients. It isn't specific to your device, your usage, or your running instance. The higher the confidence rating, the more likely closing this app and keeping it closed will result in improved battery life.

Being a hog or bug doesn't mean an app is bad. Some apps, like most games, use a lot of energy by necessity and are usually classified as hogs. Similarly, some apps use more energy under certain rare configurations or use patterns; Carat may consider these apps bugs even if the behavior is correct. Regardless, these designations can guide a user toward better battery life.

Kassner: That's the side of Carat we get to see. Can you tell us what's going on in the background and how you're using the data for research? Oliner: One goal of our work is to understand how mobile devices use energy, and to identify energy misuse. The analysis looks for patterns of behavior, such as what rate of battery drain is typical for an app, and for deviations from those patterns, such as an app that only misbehaves when Wi-Fi is unavailable. We distill these insights to hogs (power-hungry apps) and bugs (apps that are power hungry only on your device and a few others); that's what we present to our users, at the moment, but a lot is going on behind the scenes. There are many exciting features we have planned for the future. Kassner: The following slide mentions Spark. What can you tell us about it?

Oliner: Spark was the work of my colleagues in the AMP Lab. Spark is a cluster-computing framework providing a MapReduce-like interface, with support for caching intermediate results. It uses in-memory data structures called Resilient Distributed Datasets, which provide this caching. Spark was designed for iterative and incremental computations, which is precisely what our analysis performs. Kassner: It seems it might be early for official conclusions, but I was curious if you have found anything interesting or even better — unexpected? Oliner: The rapid adoption of the app took us by surprise. Many of our users were frustrated we weren't able to generate their personalized reports as soon as they installed the app. But the Carat team is small, and we did not expect 200,000 users to download the app. We completely rewrote the backend in 72 hours and are just now catching up.

Even with only a few hundred users, we found dozens of energy bugs in the wild. For example, we discovered a bug in an older version of Kindle's WhisperSync protocol that caused users running without Wi-Fi to experience dramatically worse battery life.

Now that we have several orders of magnitude more data, there is an opportunity to discover new bugs and to gain insights about the ones we already found. It's an exciting time for the project, and we're grateful to everyone who has been running Carat despite our growing pains. We're confident it will pay off for everyone involved.

Final thoughts

There are several battery saving apps on the market. I haven't had much success with any of them. Carat is different. Analyzing how a process behaves on thousands of devices allows Carat to predict accurately the energy consumption of a particular process.

Thanks, Adam for volunteering to answer for the team. My Samsung Infuse and I wish you continued success.


Information is my field...Writing is my passion...Coupling the two is my mission.

Editor's Picks