storaged: change uid_io reporting

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
This commit is contained in:
Jin Qian 2017-01-30 14:20:07 -08:00
parent f42d7c833c
commit 284bd76d3e
5 changed files with 23 additions and 24 deletions

View file

@ -36,6 +36,4 @@
2732 storaged_disk_stats (type|3),(start_time|2|3),(end_time|2|3),(read_ios|2|1),(read_merges|2|1),(read_sectors|2|1),(read_ticks|2|3),(write_ios|2|1),(write_merges|2|1),(write_sectors|2|1),(write_ticks|2|3),(o_in_flight|2|1),(io_ticks|2|3),(io_in_queue|2|1)
2733 storaged_emmc_info (mmc_ver|3),(eol|1),(lifetime_a|1),(lifetime_b|1)
2734 storaged_uid_io_alert (name|3),(read|2),(write|2),(interval|2)
2733 storaged_emmc_info (mmc_ver|3),(eol|1),(lifetime_a|1),(lifetime_b|1)

View file

@ -250,7 +250,7 @@ public:
#define DEFAULT_PERIODIC_CHORES_INTERVAL_UNIT ( 60 )
#define DEFAULT_PERIODIC_CHORES_INTERVAL_DISK_STATS_PUBLISH ( 3600 )
#define DEFAULT_PERIODIC_CHORES_INTERVAL_EMMC_INFO_PUBLISH ( 86400 )
#define DEFAULT_PERIODIC_CHORES_INTERVAL_UID_IO ( 3600 )
#define DEFAULT_PERIODIC_CHORES_INTERVAL_UID_IO ( 86400 )
// UID IO threshold in bytes
#define DEFAULT_PERIODIC_CHORES_UID_IO_THRESHOLD ( 1024 * 1024 * 1024ULL )

View file

@ -44,8 +44,10 @@ struct uid_info {
struct uid_event {
std::string name;
uint64_t read_bytes;
uint64_t write_bytes;
uint64_t fg_read_bytes;
uint64_t fg_write_bytes;
uint64_t bg_read_bytes;
uint64_t bg_write_bytes;
uint64_t interval;
};

View file

@ -90,9 +90,11 @@ status_t Storaged::dump(int fd, const Vector<String16>& /* args */) {
const std::vector<struct uid_event>& events = storaged.get_uid_events();
for (const auto& event : events) {
dprintf(fd, "%s %llu %llu %llu\n", event.name.c_str(),
(unsigned long long)event.read_bytes,
(unsigned long long)event.write_bytes,
dprintf(fd, "%s %llu %llu %llu %llu %llu\n", event.name.c_str(),
(unsigned long long)event.fg_read_bytes,
(unsigned long long)event.fg_write_bytes,
(unsigned long long)event.bg_read_bytes,
(unsigned long long)event.bg_write_bytes,
(unsigned long long)event.interval);
}
return NO_ERROR;

View file

@ -145,23 +145,20 @@ void uid_monitor::report()
for (const auto& it : uids) {
const struct uid_info& uid = it.second;
uint64_t bg_read_delta = uid.io[UID_BACKGROUND].read_bytes -
last_uids[uid.uid].io[UID_BACKGROUND].read_bytes;
uint64_t bg_write_delta = uid.io[UID_BACKGROUND].write_bytes -
last_uids[uid.uid].io[UID_BACKGROUND].write_bytes;
struct uid_event event;
if (bg_read_delta + bg_write_delta >= adjusted_threshold) {
struct uid_event event;
event.name = uid.name;
event.read_bytes = bg_read_delta;
event.write_bytes = bg_write_delta;
event.interval = uint64_t(ts_delta / NS_PER_SEC);
add_event(event);
event.name = uid.name;
event.fg_read_bytes = uid.io[UID_FOREGROUND].read_bytes -
last_uids[uid.uid].io[UID_FOREGROUND].read_bytes;;
event.fg_write_bytes = uid.io[UID_FOREGROUND].write_bytes -
last_uids[uid.uid].io[UID_FOREGROUND].write_bytes;;
event.bg_read_bytes = uid.io[UID_BACKGROUND].read_bytes -
last_uids[uid.uid].io[UID_BACKGROUND].read_bytes;;
event.bg_write_bytes = uid.io[UID_BACKGROUND].write_bytes -
last_uids[uid.uid].io[UID_BACKGROUND].write_bytes;;
event.interval = uint64_t(ts_delta / NS_PER_SEC);
android_log_event_list(EVENTLOGTAG_UID_IO_ALERT)
<< uid.name << bg_read_delta << bg_write_delta
<< uint64_t(ts_delta / NS_PER_SEC) << LOG_ID_EVENTS;
}
add_event(event);
}
set_last_uids(std::move(uids), curr_ts);