Add collectRssInBackground()
This change adds collectRssInBackground() and recordRssSampleLPf(), which are intended to be drop-in replacements for their less-efficient PSS counterparts. These methods are only used if the removeAppProfilerPssCollection flag is enabled. In general, references to PSS have been kept in places where they can apply to RSS without much friction (e.g. getLastPssTime). In places where PSS was actually recorded for use, method names were renamed to include "OrRss" (e.g. getInitialIdlePss -> getInitialIdlePssOrRss). If an app has set a PSS threshold for collecting a heap dump using ActivityManager.setWatchHeapLimit(), Debug.getPss() is called if the build is debug or the app is debuggable. This is done _in addition_ to the RSS read, but should be a relatively small cost compared to the decrease in PSS reads overall. The threshold for downgrading a service to a service B in OomAdjuster is increased by a default 1.5 when the flag is enabled to account for RSS > PSS. This value can be updated in device-specific configs, or on the command line with: device_config put activity_manager pss_to_rss_threshold_modifier <value> This flag is still disabled, so this change will have no effect once submitted. However, before the flag is flipped on in any capacity, we should notify android-chatty that the PSS info in logs/dumps will change in case these are being read for dashboards/metrics/etc. Lastly, reportCachedKill() has been removed from ProcessProfileRecord and ProcessState because while they seem to report AppProfiler-collected PSS to WW, they are actually unused. Test: - Check with test logs that collectRssInBackground() is called when the feature flag is enabled. - Check that device_config put activity_manager pss_to_rss_threshold_modifier <value> propagates to AM. Bug: 296454553 Change-Id: Ia4c4e14d7fb116e75857ea92c9fa2d2f534355f1
Loading
Please register or sign in to comment