google / google/perfetto

[RFC][Feature] Parsing Batterystats from Bugreports

Open
#934 7 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
6.5k
Forks
868
Avg merge
2d 1h
Merged PRs (30d)
218

Description

## Background context

There is a power analysis tool called Battery Historian which allows loading bug reports and viewing various timeline stats and events like battery drain, wakeups, etc. However Battery Historian appears to have been deprecated and is now directing people to use alterate tools including Perfetto: https://developer.android.com/topic/performance/power/setup-battery-historian

Perfetto is currently capable of parsing battery stats data emitted by ATrace. It is also capable of parsing data from dumpstate in bug reports, but it does not appear to be capable of parsing Battery stats events from dumpstate contained within the bug reports.

## Feature proposal
I wanted to propose closing this gap. It looks like there is already a logical place to batterystats parsing this alongside the existing android_log_reader which parses logcat from dumpstate: https://cs.android.com/android/platform/superproject/main/+/main:external/perfetto/src/trace_processor/importers/android_bugreport/android_dumpstate_reader.cc;l=117-119

In theory it should also be possible to insert these events in the SQLite DB in the same format as what results from importing battery stats data via atrace, so the existing Perfetto plugins should be able to operate transparently on the data regardless of the underlying file format.

I wanted to solicit comments on this:
- does the proposed feature make sense as part of perfetto or not?
- If yes, does the suggested implementation of extending the dumpstate importer make sense?

Contributor guide

Open the contributing guide

Research direction

Start by reading src/trace_processor/importers/android_bugreport/android_dumpstate_reader.cc and the existing android_log_reader path referenced in the issue. Review the discussion to determine whether BatteryStats parsing belongs in Perfetto and whether dumpstate is the intended entry point. The issue does not define concrete files, tests, or acceptance criteria beyond closing the parsing gap and enabling existing battery-data plugins to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, cpp
Domain
data, mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.