Similar to the ActivityReport, the PowerReport contains the power
usage for a device. To do the calculations, each of the
ComponentActivity objects are called, giving them the whole activity
info (in case they need to apportion blame) and the PowerProfile.
From that, they compute the per-component power usage, which is
then summed up into the AppPower and PowerReport objects.
Test: atest frameworks/base/tools/powermodel --host
Change-Id: Ibc9ada6f7f4a667152fc4af388f04766125ca74c
For each app that appears in the batterystats data, there is an AppActivity
object (which subclasses from AppInfo, because the needs of the upcoming
PowerReport object are similar). Inside the AppActivity, there are
ComponentActivity objects. Each power using component has a ComponentActivity
for the fields required. The additional Report objects in RawBatteryStats are
also added here.
This change usess modem data as a proof of concept. The exact fields in it
may evolve, even though the calculation uses tx and rx packets, the final power
calculation uses time, and putting the batterystats apportioning logic in the
batterystats handling code seems better than what we're doing here. Anyway,
that can be iterated upon.
Test: atest frameworks/base/tools/powermodel --host
Change-Id: I2c5fce16d4fef3628d64107562d6cf9ea4edbbc2
AttributionKey is how we identify an app. It contains either
a set of package names, read from the uid records from batterystats
(or later UidMap from statsd), or one of the hard coded SpecialApps.
Test: atest frameworks/base/tools/powermodel --host
Change-Id: If2dee6bffd2d3dafccfeff5c92bafc651b356b15
This parser builds a set of objects from the csv by looking
at the annotations on the fields. Each line in the csv
corresponds to a Record object.
Test: atest frameworks/base/tools/powermodel --host
Change-Id: Ifeae68ce3bc3a6ea9330ff924204f016bff20663
There are enough variants of csv, and it's simple enough that
it's easier to just have our own parser than to introduce a
dependency on some other library, as this library will be used
in a variety of environments.
Test: atest frameworks/base/tools/powermodel --host
Change-Id: Ib0f7aceb2a58b58f447f6bcef5c95729303dee8a
This first CL adds a class, PowerProfile that parses the power
profile xml file into a set of individual *Profile classes, one
for each of the hardware "components."
There will be more to come. This library will be used to compute
the power model from a batterystats or statsd dump, with abstractions
so clients don't need to know all of the nuances of batterystats'
old versions, or statsd's configs.
Test: atest frameworks/base/tools/powermodel --host
Change-Id: I79802f91234b09539072d10f15534cef391fe04a