Add support to detect and log excessive incoming binder calls
Make estimation on incoming binder calls. If there are too many binder transactions from certain caller with certain transaction code, log it. The threshold is configurable via device_config. The estimation here is based on the heavy hitter detection on steams. It's less accurate than the actual stats, but also less usage with the memory. Currently there are two sets of watcher configurations: the default one with a higher threshold and an "auto" one with a lower threshold. The former one overrides the later one; while the later one will be activated to run for a while in case there are consecutive ANRs, but it's throttled to run only up to once an hour. For now both of them are turned ON by default. Example of the output: 06-19 22:31:49.695 1000 1523 1609 W ActivityManager: Excessive incoming binder calls(>33.3%,2000,1744ms): [1041,com.android.server.appop.AppOpsService,checkAudioOperation,8,34.2%] 06-19 22:32:32.744 1000 1523 1609 W ActivityManager: Excessive incoming binder calls(>33.3%,2000,4938ms): [10160,com.android.server.am.ActivityManagerService,refContentProvider,25,50.7%] Bug: 155522521 Test: Pick up a service & code and loop "adb shell service call ..." Test: atest HeavyHitterSketchTest Test: atest FrameworksCoreTests:BinderHeavyHitterTest Change-Id: I4cdcce5d02797ef71190172e40a09b543478760f
Loading
Please register or sign in to comment