Skip to content
Commit 6e67ca77 authored by Lee Shombert's avatar Lee Shombert
Browse files

Improve PackageManager snapshot statistics

Bug: 184751735

This makes some small improvements to the snapshot statistics.
The change emphasizes long rebuild times over short snapshot
lifetimes.

1. The pm_snapshot_rebuild "elapsed" field is renamed "lifetime".
   This is the number of times the previous snapshot (the snapshot
   that was replaced by this rebuild)  was used.

2. The pm_snapshot_stats cumulative build time is now a long.
   Wrap-around of the 32-bit int was seen during testing.  Also, the
   "quick_rebuilds" has been renamed to "short_lived".

3. pm_snapshot_rebuild events are only logged for long rebuild times.
   Short lifetimes are still counted but do not generate their own
   events.  Also, any rebuild time that is greater than the current
   maximum rebuild time is logged, even if the number of logged events
   is greater than the limit.

4. Snapshot statistics are included in the package manager dump.   Two
   sets of statistics are presented: there is a set of 10, rolling
   over every minute, and a set of two, rolling over every week.
   The snapshot statistics are part of the default "package" dumpsys
   output and can be selected individually with "package snapshot".

5. The SnapshotStatistics class is now in its own file.  At the
   momement, the class has code that is specific to
   PackageManagerService, but it should be possible to make the class
   more generic in the future, if desired.

See the bug for sample output.

Test: manual steps -
 * Create a bug report and verify that the new statistics are present.
 * Verify that pm_snapshot_rebuild events are generated for long
   rebuild times.

Change-Id: I3197d6b76e86ecfcdaff36f47e8a6b5d4a6e456d
parent 41b21288
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment