Similar to add_record_locked, load_uid_io_proto should respect the
maximum number of records.
Bug: 111578975
Test: storaged_test.load_uid_io_proto
Change-Id: Ic3c5095cdd09d2184f436813b5ab50d3ee0007b2
Merged-In: Ic3c5095cdd09d2184f436813b5ab50d3ee0007b2
It is possible for storaged to load the same saved proto file multiple
times, for example, if system_server crashes. In this case we do not
want to fill io_history with duplicate entries. This patch elides
records for which an app+userid record already exists for the same
timestamp.
Bug: 111578975
Test: gtest storaged_test.load_uid_io_proto
Change-Id: I87bc3e37d6464079cece03b5852285d79067b935
Merged-In: I87bc3e37d6464079cece03b5852285d79067b935
protobuf is only needed when serializing/deserializing data. Instead of
maintaining a permanent buffer in storaged object, move the container to
stack so that the buffer is released when we don't need it. In addition,
we don't need to clear the buffer before updating it.
Also added a function to clear user io history when the user is removed.
Bug: 63740245
Change-Id: Ia5d19b9a0c3f92a93b061a56be89bb0b958a2a29
Use user_id (from app uid) to determine file location.
/data/misc_ce/<user_id>/storaged/storaged.proto
Vold notifies storaged when a user's CE area becomes available.
Then storaged restores data from the proto in that area and
combines them into IO history.
Vold also notifies storaged when the CE area is being deleted.
Storaged clears internal history about this user and deletes the
proto file.
IO perf is stored in user_0 area since it's not user related.
Test: dumpsys storaged before/after multiple users' unlock
Bug: 63740245
Change-Id: I39f923f6b09e9f2a29e9286ce02b3b3bcbfb9f94
Split binder calls into two separate services.
"storaged" service will be used by external clients, e.g. vold.
- Added stub onUserStarted/onUserStopped to prepare for moving
storaged.proto into ce area.
"storaged_pri" private service will be used by storaged cmdline,
e.g. adb shell storaged -u
- Added parcelable UidInfo for private service.
- Change format of perf history to one vector with first 3 elements
showing size of recent/daily/weekly perf history.
Test: adb shell storaged -u -p
Bug: 63740245
Change-Id: Ib0367282a95b6cb0a38f064f0456e849ecccc210
Record the bandwidth when writing storaged.proto to monitor system
storage performance.
The history is maintained in 3 catergories.
1. samples of last 24 hours.
2. daily average of last 7 days.
3. weekly average of last 52 weeks.
Sampling frequency of the first catergory is set to once every hour.
Storaged also flushes proto at same frequency.
The proto file is padded to reach a minimal size of 128KB. Storaged
writes 16KB at a time. Bandwidth calculation ignores time spent in
the first write and writes smaller than 16KB.
bandwidth = total size of 16KB writes / time spent in 16KB writes
Restructured the code so that storaged.cpp handles proto load/flush.
It calls individual module to sync proto with internal data
structures.
Added a cmdline argument to dump perf history.
adb shell storaged -p
I/O perf history (KB/s) : most_recent <--------- least_recent
last 24 hours : 5315 3775 3659 2042 3890 5652 3649 3696 6023
last 7 days : 4648 3532 3828 3567 3841 3359 4676
last 52 weeks : 3817 4275 3836 3766 4280 0 0 0 0 0 ...
Test: adb shell storaged -p
atp:asit/perf/jank_systemui_test
atp:asit/perf/appstartup_hermetic_cyclic_dropcache_test
atp:asit/perf/appstartup_non_hermetic_cyclic_dropcache_test
Bug: 63629306
Change-Id: Ie7051e7a8df883d4a6818ea9a54a10f4dccb4843
Merged disk_stats_publisher into disk_stats_monitor class.
Moved proc file check to disk_stats class instead of doing so in
storaged, same for uid_io.
Added is_zero function to check zero disk_stats.
Added operators to compute disk_stats.
Change-Id: I277ae51f6fe18464f92e45c03471343784e67093
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
Change-Id: I2a181f52c9f19de1e679a3a905aaebafe4d08227
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
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 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