diff options
author | Jin Qian <jinqian@google.com> | 2016-12-28 15:43:51 -0800 |
---|---|---|
committer | Jin Qian <jinqian@google.com> | 2017-01-24 14:45:35 -0800 |
commit | bcd6e3b9d92b2eea3b054372c9adf00a1e6235bc (patch) | |
tree | 266fa372c83a1480570cd5e8878e7bdcc50c0a3b /storaged/storaged.cpp | |
parent | 933d02818bbbfa732392c9e78edb643b113717cc (diff) | |
download | core-bcd6e3b9d92b2eea3b054372c9adf00a1e6235bc.tar.gz core-bcd6e3b9d92b2eea3b054372c9adf00a1e6235bc.tar.bz2 core-bcd6e3b9d92b2eea3b054372c9adf00a1e6235bc.zip |
storaged: monitor per-uid IO usage
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
Diffstat (limited to 'storaged/storaged.cpp')
-rw-r--r-- | storaged/storaged.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/storaged/storaged.cpp b/storaged/storaged.cpp index e4d3e686e..0c53f4482 100644 --- a/storaged/storaged.cpp +++ b/storaged/storaged.cpp @@ -174,9 +174,12 @@ storaged_t::storaged_t(void) { } } + mConfig.proc_uid_io_available = (access(UID_IO_STATS_PATH, R_OK) == 0); + mConfig.periodic_chores_interval_unit = DEFAULT_PERIODIC_CHORES_INTERVAL_UNIT; mConfig.periodic_chores_interval_disk_stats_publish = DEFAULT_PERIODIC_CHORES_INTERVAL_DISK_STATS_PUBLISH; mConfig.periodic_chores_interval_emmc_info_publish = DEFAULT_PERIODIC_CHORES_INTERVAL_EMMC_INFO_PUBLISH; + mUidm.set_periodic_chores_interval(DEFAULT_PERIODIC_CHORES_INTERVAL_UID_IO_ALERT); mStarttime = time(NULL); } @@ -202,5 +205,10 @@ void storaged_t::event(void) { mEmmcInfo.publish(); } + if (mConfig.proc_uid_io_available && mTimer && + (mTimer % mUidm.get_periodic_chores_interval()) == 0) { + mUidm.report(); + } + mTimer += mConfig.periodic_chores_interval_unit; } |