summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge "storaged: lower capabilities in init"Treehugger Robot2018-04-121-0/+1
|\
| * storaged: lower capabilities in initDavid Anderson2018-04-111-0/+1
| | | | | | | | | | | | | | | | | | Lower storaged's capabilities to DAC_READ_SEARCH as an initial step toward running it non-root. Bug: 77634061 Test: storaged still runs and its /proc/pid/status has lower CapPrms Change-Id: Ibfe0349fc059e2f37efba33f587176e8ce6be9fe
* | storaged: update OWNERSDavid Anderson2018-04-111-1/+1
|/ | | | | | Bug: N/A Test: N/A Change-Id: Ic3e3fbcb4c4357a286ef05feab68e65390e2eab3
* storaged: remove unused includesDavid Anderson2018-04-051-3/+0
| | | | | | Bug: 35323867 Test: N/A Change-Id: I21c0b62765dbd27a462288c5e7577905240720f0
* storaged: owner adjustmentMark Salyzyn2018-03-231-0/+1
| | | | | | | | Added salyzyn@ for final owner review on adjustments to storaged. Test: none Signed-off-by: Mark Salyzyn <salyzyn@google.com> Change-Id: Iac73403ea416a4820f72689f5860aa88931def06
* Merge "Add OWNERS."Elliott Hughes2017-12-071-0/+1
|\
| * Add OWNERS.Elliott Hughes2017-12-071-0/+1
| | | | | | | | | | | | Bug: N/A Test: N/A Change-Id: Ie785058c0f5eb9b4086c98ccba6e63e3ed411b65
* | storaged: call getNamesForUids to get uid namesJin Qian2017-08-082-21/+46
| | | | | | | | | | | | | | | | | | | | Calls getNamesForUids when one of the two conditions are true. 1. entries for new uids are reported from io stats 2. previous getNamesForUids failed Bug: 62805090 Merged-In: I120b81e1857b2aa0a90d0fb85c8d749e985df78e Change-Id: I120b81e1857b2aa0a90d0fb85c8d749e985df78e
* | storaged: fix excessive accounting when io usage has negative deltaJin Qian2017-08-031-4/+4
| | | | | | | | | | | | | | | | | | When current io bytes are smaller than previous bytes, add 0 to delta instead of adding current io bytes. Bug: 64317562 Merged-In: If0c9814892ad61b790baa6395649af10b11d5b7c Change-Id: I1ffd7ac33649ab3b8405c83b1328fa9bf49702c0
* | storaged: record userdata space utilizationJin Qian2017-07-175-30/+75
|/ | | | | | | | Update disk space utilization together with diskstats since we will use free space size to co-relate disk performance. Bug: 63629306 Change-Id: I4e5694aaff3b71aa56db451f1bc92ccfb07e5086
* storaged: stop binder threads before exitingJin Qian2017-04-041-0/+2
| | | | | | Test: kill healthd when storaged is running Bug: 36652060 Change-Id: Ie55fb6cb7c8c6df6ce6bc4820c476b90cc0f4165
* storaged: exit if batteryproperties service is dead.Jin Qian2017-04-042-2/+17
| | | | | | | | | | | storaged relies on batteryproperties service (healthd) to provide charger stats. If healthd is killed, kill storaged as well. Both will be restarted by init process anyway to restore a correct state. Test: kill healthd when storaged is running Bug: 36652060 Merged-In: Ia785bb6f5ea259aa43cd1efab9505ebefaf3db12 Change-Id: Ia785bb6f5ea259aa43cd1efab9505ebefaf3db12
* storaged: use sp<> to keep refcount for storaged_t objectJin Qian2017-04-042-8/+8
| | | | | | | | | | | BatteryListener takes sp<> as parameter. Passing raw storaged_t ptr to BatteryListener will cause the ptr to be freed when BatteryListener releases the sp<>. Keep a refcount in storaged to prevent this from happening. Test: kill healthd while storaged is running Bug: 36652060 Change-Id: I96bc45a3bedb39eb7158b8f6c86334b5b31c9346
* storaged: skip batteryproperties listener if uid_io not availableJin Qian2017-04-031-0/+3
| | | | | | | | | uid_monitor is the only user of batteryproperties, no need to register a callback if uid_io not enabled. Test: run storaged without uid_io, plug/unplug usb cable Merged-In: If890a93fec155b67c450341c54b44bb18d3aae3d Change-Id: If890a93fec155b67c450341c54b44bb18d3aae3d
* storaged: add support for ufs health infoJin Qian2017-04-032-1/+60
| | | | | | | Test: adb logcat -d -b events | grep storaged_emmc_info Bug: 36228467 Merged-In: I519fe2b8a99c1c31f1fe720bd671904d1ab609bb Change-Id: I519fe2b8a99c1c31f1fe720bd671904d1ab609bb
* storaged: read emmc health data from sysfsJin Qian2017-04-037-93/+79
| | | | | | | | | | | | | Sysfs data is straightforward so we don't need parsing anymore. Also removed periodical check since data is set only once during driver initialization. Checking at every device boot or storaged restart should be sufficient to monitor long term status change. Test: adb logcat -d -b events | grep storaged_emmc_info Bug: 36228467 Merged-In: I2a181f52c9f19de1e679a3a905aaebafe4d08227 Change-Id: Ic05e353f0af9363f3bcbe793ba0c351082e446ca
* storaged: rewrite emmc info classJin Qian2017-03-168-173/+192
| | | | | | Test: adb logcat -d -b events | grep storaged_emmc_info Bug: 36228467 Change-Id: Ib799e60ed65661a9fb99be8ad4c930f547339975
* storaged: clean up output formatJin Qian2017-03-142-24/+12
| | | | | | | make it easy to use scripts parsing output Test: adb shell storaged -u Change-Id: I459078c4ddf6e18fe1eb05d25d564e6e6d03e87e
* storaged: replace string functions that can throw exceptionJin Qian2017-03-142-22/+27
| | | | | | | | | | android coding style doesn't allow exception handling which leads to crash when any function throws exception. Replace such functions in storaged to gracefully handle invalid inputs. Test: adb shell dumpsys storaged --hours N --time_window 300 Bug: 36131658 Change-Id: I36be1b49c4d9977a01d1bd4c9ca57d49322d95f4
* storaged: remove usage of String16::std_stringSteven Moreland2017-03-101-3/+3
| | | | | | | <string> is being removed from String16 Test: adb shell dumpsys storaged <all options> Change-Id: I234ecd64d9c481cb2eeee883a715f2fbfaecc511
* storaged: track fsync callsJin Qian2017-03-023-21/+32
| | | | Change-Id: Ibdb6a1703245a5de04cb4a2ee5b8ecfbed8b86fc
* storaged: reduce storaged privilegeJin Qian2017-02-272-19/+2
| | | | | | | | | Remove storaged from system group. Let init set priority based on rc file. Test: adb shell dumpsys storaged --force Bug: 35323867 Change-Id: I9d893ec69d9cc34a9e24f47166384efd7ef4d9d2
* storaged: include start time in IO usage dumpsysJin Qian2017-02-214-23/+44
| | | | | | | | | | | | | New format: starttime1,endtime1 records [starttime2],endtime2 records Note starttime2 is skipped if it equals with endtime1. Bug: 34198239 Change-Id: I8a88a3bf1d50e065510d3ab123422d564fb6159f
* storaged: handle negative delta in io usageJin Qian2017-02-161-8/+13
| | | | | | | | | | When UID is uninstalled and reinstalled, IO usage of the UID is reset. This caused problem in accounting since it assumes IO usage is always increasing for the same UID. In such case, use the current usage instead of negative delta for accounting. Bug: 34198239 Change-Id: I74661feccc05d19ba8a0feff8a2e38d72c7d1465
* storaged: fix selinux dac_override denialJin Qian2017-02-103-27/+2
| | | | | | Bug: 35250057 Bug: 34198239 Change-Id: I18592d298765dc46ab05f25ae2ced0a5eddacc8b
* storaged: allow dump window to be less than an hourJin Qian2017-02-104-6/+6
| | | | | | | | This is useful for CTS where we just need dump from last few minutes. Bug: 34198239 Bug: 34845096 Change-Id: Ic543e7184606f419f8989bf0cb992cd46e48845c
* storaged: add --force option to dumpsysJin Qian2017-02-104-6/+16
| | | | | | | | | | | This option forces storaged to generate io usage report since last report. This is for testing purpose so that we can run some app and get the app's IO usage right away instead of waiting an hour for next report. Bug: 34198239 Bug: 34845096 Change-Id: I9cd217df37a9b6c8f383eb25d41602e8e8c8f9ba
* storaged: add dumpsys flags to limit data sizeJin Qian2017-02-104-6/+51
| | | | | | | | | | | | | | --threshold <bytes> This skips io usage not greater than <bytes> for current report. --time_window <secs> This sets uid_io collection interval to <secs> for future reports. The new interval will be ignore if it's less than 5 minutes. Test: adb shell dumpsys --threshold 4096 --time_window 300 Bug: 33086174 Bug: 34198239 Change-Id: I723c0850fa504a113da0a14945c4fbc64ea47659
* storaged: account on/off charger per uid io usageJin Qian2017-02-078-143/+252
| | | | | | | | | | | Register a listener to batteryproperties service for charger stats change. Aggregate IO usage based on charger stats in a collection window. Bug: 33086174 Bug: 34198239 Change-Id: Ibe306c9c3ff8b8ada6be034aa8511268cb9a9b1c
* Merge "Add permission bits to open with O_CREAT."TreeHugger Robot2017-02-031-1/+1
|\
| * Add permission bits to open with O_CREAT.George Burgess IV2017-02-031-1/+1
| | | | | | | | | | | | | | | | | | It's an error to pass open O_CREAT without giving it mode bits: https://linux.die.net/man/3/open Bug: 32073964 Test: Compiles with clang FORTIFY. Change-Id: Iaa78c3003ed960e1ffe7e56623dba33db4e17443
* | storaged: add --hours flag for dumpsysJin Qian2017-02-015-26/+70
|/ | | | | | | | | | | | | | | 1. Add a flag to report IO usage for last N hours. 2. Change interval back to 1 hour so that we have finer usage data. 3. Don't clear events after dumpsys call. Use a max buffer limit. 4. Clear old events if they're more than 5 days old or when no room for new events. 5. Skip uids with no IO usage to save space. 6. Replace interval with a timestamp in event entry. Test: adb shell dumpsys storaged --hours 2 Bug: 34198239 Bug: 33086174 Change-Id: I66e8fb6ec155584115fab817c3ed2c78e637ac40
* storaged: change uid_io reportingJin Qian2017-01-305-26/+25
| | | | | | | | | | | Increase reporting interval to once per day. Report foreground and background I/O usage. Remove threshold to report all usages. Test: adb shell dumpsys storaged Bug: 34198239 Bug: 33086174 Change-Id: I3b4ea8200bdb8becb5b441051f52477bbd1f3ccf
* storaged: fix check_time logicJin Qian2017-01-261-3/+10
| | | | | | | | | | Skips event time check if failed to get start time. Use ratelimited logging when gettime fails. Test: adb shell setprop ro.storaged.event.perf_check 10000 Bug: 34630954 Bug: 34198239 Change-Id: I168ef3b4e4ed27257ec76373219c6214a7b7b2ed
* storaged: add dumpsys interfaceJin Qian2017-01-255-4/+77
| | | | | | | | | | Write alerts to an internal buffer and flush to dumpsys when dump is called. Test: adb shell dumpsys storaged Bug: 33086174 Bug: 34198239 Change-Id: I39e5dfd9c4e9a5f3ec3d74356b28e9ddf77f6624
* storaged: remove task io codeJin Qian2017-01-249-526/+4
| | | | | Bug: 34612499 Change-Id: Id0599ee2ae025a186259e95363c1ddd0feae8079
* storaged: replace cmd arguments with propertiesJin Qian2017-01-247-102/+67
| | | | | | | | | Add properties to control event intervals. Add a property to check time spent in event loop. Bug: 34612341 Bug: 34198239 Change-Id: I01f64c84e17153377ece7ae530be106e3f55287e
* storaged: monitor per-uid IO usageJin Qian2017-01-2412-8/+381
| | | | | | | | | Add uid_monitor class to query /proc/uid_io/stats periodically. Add a log tag to record any UID that exceeds IO threshold. Test: adb shell storaged -u Bug: 34198239 Change-Id: I53568c30dbefe2f4bdb18054d3dedb30b4133d8b
* storaged: disable taskio since it's too expensiveJin Qian2017-01-201-0/+2
| | | | | | | | | | | | | | | | | It has no active user and will be replaced by uid io. |--99.99%-- storaged_t::event() | |--99.68%-- tasks_t::update_running_tasks() | | | |--93.00%-- parse_task_info(unsigned int, task_info*) | | | | |--49.94%-- android::base::ReadFileToString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool) | | | | |--29.00%-- read | | | | |--5.00%-- std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(unsigned long&) | | | | |--4.83%-- android::base::StringPrintf(char const*, ...) | | | | |--1.93%-- android::base::Split(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Bug: 34263766 Bug: 34198239 Change-Id: I3f4851b5ce27751eebd40f4b56e1ee24297c4c7d
* storaged: assign to system-background cpusetJin Qian2017-01-181-0/+1
| | | | | Bug: 34388593 Change-Id: I11d904cade1d67e54b5e651b6fc1ad34d365690e
* storaged: fix crash when cmdline is longer than 64 charactersJin Qian2017-01-172-4/+4
| | | | | Bug: 34331490 Change-Id: I40302f4d54b7d8fe4fc5ecbc76df42df68a35504
* storaged: remove redundant loggingJin Qian2017-01-173-43/+11
| | | | | | | | | | Don't log disk_stats and emmc_info to system buffer since they are already uploaded to events buffer. Use DEBUG flag to control disk perf logging. Bug: 34331490 Change-Id: I5f628a1a46e1f72588da064523da69737bd67dcb
* storaged: increase periodic polling intervalJin Qian2017-01-171-3/+3
| | | | | | | | | set default polling internal to 1 minute set default disk stats publish to 1 hour set default emmc info publish to 1 day Bug: 34331490 Change-Id: Ifd86ddf9d826fb252de9dc8d6881e80ccb193e3b
* storaged: replace kmsg with LOG macrosJin Qian2017-01-134-151/+45
| | | | | | Also convert android_log_event to C++ style calls. Change-Id: I7d62c81789fe7925fe9cae3e2a798b6af8c8be9d
* Storaged cleanupynwang2016-12-215-19/+14
| | | | | | | | Compliance with Android Coding standards Test: compile Bug: 28826771 Change-Id: I10bc4a793bb1da75e8600b81a5d7ff913e310da1
* storaged: add storaged native daemonynwang2016-12-1512-0/+2324
Storaged periodically checks the devices' disk stats and eMMC lifetime. This information is logged to both the kernel and event log. By event logging, the data can be aggregated by the checkin service and then sent to Sawmill. It also periodically traverses /proc/[pid], maintaining the I/O usage of all tasks (all sampled tasks). The task I/O data can be reported using the --dump option. Storaged is booted when the device boots up and requires the permission for reading /proc/diskstats, /proc/[pid]/io and debugfs(eMMC ext_csd). For detailed description, please refer to go/storaged. Bug: 28826771 Change-Id: I774b1a44cc30092bac1bfcbc08bf487295e7cfed