Put AIDL files into a filegroup so they can be imported as sources
for framework.jar.
Test: m checkbuild
Change-Id: I1a5335384e9291af1f26e7418f15fcfa082ee356
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
Use proto_stat to indicate status of CE area. Before user_0 unlocks,
storaged detects CE NOT_AVAILABLE when attempting to read the proto
file. It then skips reading/writting the proto.
When user_0 logs in, vold calls onUserStart in storaged, which sets
proto_stat to AVAILABLE. At next event, storaged tries to read the
proto. If it's a success, proto_stat is changed to LOADED. After that,
storaged reads and writes proto normally.
Test: adb shell storaged -u -p
Bug: 63740245
Change-Id: I1fdd42c430e91682f6cc07497fcad5be52489b4e
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
comm field in task io stats string can have comma since this field
includes task arguments. As a result, splitting the string by comma
doesn't always give 13 fields. Parse the string in following way to
fix that.
last 11 fields -> pid and io stats
Second field to 12th from last -> comm
Bug: 63739275
Change-Id: I6a2418260444c71d6492fc6cbd639d3cc54ceaed
Convert storaged internal io_history to protobuf format and serialize
it to userdata partition. Also load this file during storaged startup
to reconstruct io history.
Bug: 63740245
Change-Id: I0697525df1c31fdec20f5ed4e3e9363e2dde244f
Rank uids by io stats and display their tasks. Can either rank by combining
io stats for same uids or io stats for the last appearing uid.
See python ranker.py -h for details.
Test: python ranker.py -i io.txt -o output.txt -u 20 -cnt
Bug: 63739275
Change-Id: Ieee1d7a9bf190266fc6a055c0922434fcd9099c6
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
Change-Id: I120b81e1857b2aa0a90d0fb85c8d749e985df78e
Display task io in dump service when both kernel logs task io to
proc/uid_io/stats and when debug flag is enabled.
Also add -t flag to display both uid and task io for storaged.
Tests:
adb shell
dumpsys storaged --debug
storaged -t
Bug: 63739275
Change-Id: If0c9814892ad61b790baa6395649af10b11d5b7c
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 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
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
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
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
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
Remove storaged from system group.
Let init set priority based on rc file.
Test: adb shell dumpsys storaged --force
Bug: 35323867
Change-Id: I9d893ec69d9cc34a9e24f47166384efd7ef4d9d2
New format:
starttime1,endtime1
records
[starttime2],endtime2
records
Note starttime2 is skipped if it equals with endtime1.
Bug: 34198239
Change-Id: I8a88a3bf1d50e065510d3ab123422d564fb6159f
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
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
--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
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
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
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
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
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
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
Add properties to control event intervals.
Add a property to check time spent in event loop.
Bug: 34612341
Bug: 34198239
Change-Id: I01f64c84e17153377ece7ae530be106e3f55287e
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