summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/am/ProcessStatsService.java
AgeCommit message (Collapse)Author
2013-12-19Move some system services to separate directoriesAmith Yamasani
Refactored the directory structure so that services can be optionally excluded. This is step 1. Will be followed by another change that makes it possible to remove services from the build. Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
2013-11-06Fix issue #11223338: Not retaining service started state while restartingDianne Hackborn
When I cleaned up how we maintained the lifecycle of the tracker with a service, I broke most tracking of the service restart state. (Since at that point the service is no longer associated with a process, so I must clean up the tracker state). This change introduces a new special case for interacting with a service tracker to explicitly tell it when a service is being restarted. It also fixes how we update the process state when services are attached to it, so it goes in and out of the restarting state correctly. In addition: - Maybe fix issue #11224000 (APR: Dependent processes not getting added to LRU list). We were not clearing ServiceRecord.app when bringing down a service, so if for some reason there were still connections to it at that point (which could happen for example for non-create bindings), then we would so it when updating the LRU state of that client process. - dumpsys procstats's package argument can now be a package or process name, and we will dump all relevent information we can find about that name. - Generally improved the quality of the dumpsys procstats output with its various options. - Fixed a bug in ActivityManager.dumpPackageState() where it would hang if the service was dumping too much, added meminfo to the set of things dumped, and tweaked command line options to include more data. - Added some more cleaning code to ActiveServices.killServices() to make sure we clean out any restarting ServiceRecord entries when a process is being force stopped. - Re-arranged ActiveServices.killServices() to do the main killing of the service first, to avoid some wtf() calls that could happen when removing connections. Bug: 11223338 Bug: 11224000 Change-Id: I5db28561c2c78aa43561e52256ff92c02311c56f
2013-10-22Fix issue #11323037: Android apk incorrectly marked as running in app processesDianne Hackborn
The android package is now a special case, not being added to the package list when creating a multi-process component. There is no need, since this package is actually the framework itself which must be loaded in every process. Also cleaned up some of the procstats dump output to help see what is going on here. Change-Id: If65d35ecd562f3154bdebfded69c454af6ce8c96
2013-10-10Fix issue #11175600: Proc stats is aggregating stats in the wrong directionDianne Hackborn
Change-Id: I7f06fbde8f52296cb2932003b4da77b2c68a6011
2013-10-09Fix issue #11087316: Can't run dumpsys procstats on user builds in some cases!Dianne Hackborn
Once we pass the dump perm check, we are safe. Change-Id: I58f483573874ca9f8f914fb94137f8a2afafaf25
2013-10-03Fix issue #11069176: Crash showing process statsDianne Hackborn
Change-Id: Ie568ebcb9863bed95c775b9b28654a5e2dc464cd
2013-10-01Fix issue #11005453: [SUW] G+ profile creation for new user brokenDianne Hackborn
The main problem here was a mistake when turning a single process structure to a multi-package-process structure with a common process. When we cloned the original process state, if there were any services already created for the process for that package, they would be left with their process pointer still referencing the original now common process instead of the package-specific process, allowing the active counts to get bad. Now we switch any of those processes over to the new package-specific process. There was also another smaller issue with how ServiceRecord is associated with a ServiceState -- we could be waiting for an old ServiceRecord to be destroyed while at the same time creating a new ServiceRecord for that same service class. These would share the same ServiceState, so when the old record finally finished destroying itself it would trample over whatever the new service is doing. This is fixed by changing the model to instead of using an "active" reference count, we have an object identifying the current owner of the ServiceState. Then when the old ServiceRecord is cleaning up, we know if it is still the owner at that point. Also some other small things along the way -- new Log.wtfStack() method that is convenient, new suite of Slog.wtf methods, fixed some services to use Slog.wtf when catching exceptions being returned to the caller so that we actually know about them. Change-Id: I75674ce38050b6423fd3c6f43d1be172b470741f
2013-09-29Fix issue #10948509: Crash in procstats when there is no dataDianne Hackborn
Not dealing with the case where there is a null list. Also fixed some bugs I found while looking at this: - When resetting the stats, we would use a newly computed time stamp for the total durations rather than the one we used to reset the proc/service entries. This would result in them being able to be slightly > 100%. - There was a bug in how we split a single process state into its per-package representation, where we would but the cloned process state into the new package's entry (instead of properly for its own package entry), to be immediately overwritten by the new process state we make for that package. This could result in bad data for processes that have multiple packages. - There was a bug in resetting service stats, where we wouldn't update the overall run timestamp, allowing that time to sometimes be > 100%. - There was a bug in computing pss data for processes with multiple packages, where the pss data was not distributed across all of the activity per-package process states. - There was a bug in computing the zram information that would cause it to compute the wrong value, and then never be displayed. Finally a little code refactoring so that ProcessState and ServiceState can now share a common implementation for the table of duration values. Change-Id: I5e0f4e9107829b81f395dad9419c33257b4f8902
2013-09-23Implement issue #10895990: Better durations for proc statsDianne Hackborn
Reduce the batching down to 3 hours, so that we can show shorter durations in the UI. Change-Id: I46af674b0024b828595ed3cdad2b47fe47d71ed8
2013-09-17Maybe fix issue #10797796: IllegalStateException in ProcessState...Dianne Hackborn
...caused runtime restart There were some situations where the package list could be set with process stats when it shouldn't. Not sure if this is causing the problem, since there is no repro. Also some improvements to debug output -- new commands to clear all stats, print full details of stats, and print a one-day summary (which should match what the UI shows). Change-Id: I9581db4059d7bb094f79f2fe06c1ccff3e1a4e74
2013-09-16Fix issue #10779747: Calendar Storage crash observed...Dianne Hackborn
...while setting up a new user from settings. The delayed service start stuff was too aggressive -- it would allow a process to be killed between the an onReceive() that calls startService() and that service being started. This means that apps that set up global state that they expect to remain set up during that time could be lost. This is the first part of a fix, which tightens up when we allow services to be delayed. Now we will immediately start the service as long as it currently as a process running that is not in the cached state. (Previously we would delay if the process was in the receiver state.) This unfortunately means that our service start delay is much less effective. To address that, there will be a follow-on change to tie broadcast delivery into this to see if we can delay the finish of a broadcast as long as there are background services starting in that process. Change-Id: I2bba2295d10699ee3479375bbe87114b2cbb0826
2013-09-16Work on issue #10771346: runtime restartDianne Hackborn
Haven't found the underlying cause, but this will give us more information when we get into the bad state. Change-Id: I9aebd3a025a7c0d931f43098461b64ee3c220746
2013-09-09Fix issue #10671878: Proc stats needs to remove old data structuresDianne Hackborn
We now keep track of which process and service states are actively in use, and remove any that are not in use during a commit. The activity manager needed to be tweaked to report this data, and ensure it does not try to operate on one of these structures when not in use. Also some other fixes: - We now keep track of process names associated with services, for display in the UI. - Keep track of total run time for each service, also for UI. - The parceled format is more efficient, not storing duplicates of process/package names, and writing times as ints when possible. - Reduced commit period from 1 day to 12 hours, so that our UI can be a little closer at its attempt to display the stats over 1 day. Change-Id: Ifeda0ffe963a7b49d8eb2a3f6923f3a5e71a4e43
2013-09-06Fix to show correct duration.Dianne Hackborn
Change-Id: I1032d90d5b7bf39006b20f3374104421dcc53305
2013-09-03Fix issue #10427108: Google+ has long running processDianne Hackborn
There was a bug in counting the number of starting services in a process that would cause it to count too many (it would increment at any state change while the service is started, not just when starting/stopping). Also reduce dumpsys output -- only print summaries for old data. There is probably no utility in printing the long details of all that data. Change-Id: I1c1e901b0214c01eb7d071f23166fc6f3702ca67
2013-08-09More stuff I need for the proc stats UI.Dianne Hackborn
Change-Id: I5f05b79bc4d5766a80f2db9d20ba8078b60c1b00
2013-08-09Add method for adding two ProcessStats objects together.Dianne Hackborn
Also move file reading code over to ProcessStats. Change-Id: Ib42272b90a408a494044965e98beed16c0b3f8a5
2013-08-08Get ProcessStats callable from other processes.Dianne Hackborn
Also fix a bug where, when parceling the stats, we were computing the final duration values too late. We need to do that before we write the long table. Change-Id: Idb6c1ed95417448c56973fe5866bfb3570e525f4
2013-08-07Start adding IPC calls to retrieve proc stat data.Dianne Hackborn
Also fix a bug where we were not correctly unparcelling service duration data. Change-Id: Ie9113b2e3a747622441b1939ffc45edb5803a10f
2013-08-06Refactor ProcessStats, ProcessTracker.Dianne Hackborn
ProcessStats is now called ProcessCpuTracker. ProcessTracker is now ProcessStatsService, and its inner State class is broken out into a separate top-level ProcessStats class. This ProcessStats is moved to the framework, so we will be able to use it elsewhere. Change-Id: I6a127bcb835b6b474b72647c0b99b82c2137e5c5