summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'storaged')
-rw-r--r--storaged/EventLogTags.logtags4
-rw-r--r--storaged/include/storaged.h2
-rw-r--r--storaged/include/storaged_uid_monitor.h6
-rw-r--r--storaged/storaged_service.cpp8
-rw-r--r--storaged/storaged_uid_monitor.cpp31
5 files changed, 25 insertions, 26 deletions
diff --git a/storaged/EventLogTags.logtags b/storaged/EventLogTags.logtags
index 71fda25e5..2e25d4a29 100644
--- a/storaged/EventLogTags.logtags
+++ b/storaged/EventLogTags.logtags
@@ -36,6 +36,4 @@
36 36
372732 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) 372732 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)
38 38
392733 storaged_emmc_info (mmc_ver|3),(eol|1),(lifetime_a|1),(lifetime_b|1) 392733 storaged_emmc_info (mmc_ver|3),(eol|1),(lifetime_a|1),(lifetime_b|1) \ No newline at end of file
40
412734 storaged_uid_io_alert (name|3),(read|2),(write|2),(interval|2) \ No newline at end of file
diff --git a/storaged/include/storaged.h b/storaged/include/storaged.h
index c6cdd81c7..41bdf9744 100644
--- a/storaged/include/storaged.h
+++ b/storaged/include/storaged.h
@@ -250,7 +250,7 @@ public:
250#define DEFAULT_PERIODIC_CHORES_INTERVAL_UNIT ( 60 ) 250#define DEFAULT_PERIODIC_CHORES_INTERVAL_UNIT ( 60 )
251#define DEFAULT_PERIODIC_CHORES_INTERVAL_DISK_STATS_PUBLISH ( 3600 ) 251#define DEFAULT_PERIODIC_CHORES_INTERVAL_DISK_STATS_PUBLISH ( 3600 )
252#define DEFAULT_PERIODIC_CHORES_INTERVAL_EMMC_INFO_PUBLISH ( 86400 ) 252#define DEFAULT_PERIODIC_CHORES_INTERVAL_EMMC_INFO_PUBLISH ( 86400 )
253#define DEFAULT_PERIODIC_CHORES_INTERVAL_UID_IO ( 3600 ) 253#define DEFAULT_PERIODIC_CHORES_INTERVAL_UID_IO ( 86400 )
254 254
255// UID IO threshold in bytes 255// UID IO threshold in bytes
256#define DEFAULT_PERIODIC_CHORES_UID_IO_THRESHOLD ( 1024 * 1024 * 1024ULL ) 256#define DEFAULT_PERIODIC_CHORES_UID_IO_THRESHOLD ( 1024 * 1024 * 1024ULL )
diff --git a/storaged/include/storaged_uid_monitor.h b/storaged/include/storaged_uid_monitor.h
index fffed6f19..9101767e5 100644
--- a/storaged/include/storaged_uid_monitor.h
+++ b/storaged/include/storaged_uid_monitor.h
@@ -44,8 +44,10 @@ struct uid_info {
44 44
45struct uid_event { 45struct uid_event {
46 std::string name; 46 std::string name;
47 uint64_t read_bytes; 47 uint64_t fg_read_bytes;
48 uint64_t write_bytes; 48 uint64_t fg_write_bytes;
49 uint64_t bg_read_bytes;
50 uint64_t bg_write_bytes;
49 uint64_t interval; 51 uint64_t interval;
50}; 52};
51 53
diff --git a/storaged/storaged_service.cpp b/storaged/storaged_service.cpp
index 2799c3933..86a2b219b 100644
--- a/storaged/storaged_service.cpp
+++ b/storaged/storaged_service.cpp
@@ -90,9 +90,11 @@ status_t Storaged::dump(int fd, const Vector<String16>& /* args */) {
90 90
91 const std::vector<struct uid_event>& events = storaged.get_uid_events(); 91 const std::vector<struct uid_event>& events = storaged.get_uid_events();
92 for (const auto& event : events) { 92 for (const auto& event : events) {
93 dprintf(fd, "%s %llu %llu %llu\n", event.name.c_str(), 93 dprintf(fd, "%s %llu %llu %llu %llu %llu\n", event.name.c_str(),
94 (unsigned long long)event.read_bytes, 94 (unsigned long long)event.fg_read_bytes,
95 (unsigned long long)event.write_bytes, 95 (unsigned long long)event.fg_write_bytes,
96 (unsigned long long)event.bg_read_bytes,
97 (unsigned long long)event.bg_write_bytes,
96 (unsigned long long)event.interval); 98 (unsigned long long)event.interval);
97 } 99 }
98 return NO_ERROR; 100 return NO_ERROR;
diff --git a/storaged/storaged_uid_monitor.cpp b/storaged/storaged_uid_monitor.cpp
index fd30f5f5b..5f664e4e2 100644
--- a/storaged/storaged_uid_monitor.cpp
+++ b/storaged/storaged_uid_monitor.cpp
@@ -145,23 +145,20 @@ void uid_monitor::report()
145 145
146 for (const auto& it : uids) { 146 for (const auto& it : uids) {
147 const struct uid_info& uid = it.second; 147 const struct uid_info& uid = it.second;
148 uint64_t bg_read_delta = uid.io[UID_BACKGROUND].read_bytes - 148 struct uid_event event;
149 last_uids[uid.uid].io[UID_BACKGROUND].read_bytes; 149
150 uint64_t bg_write_delta = uid.io[UID_BACKGROUND].write_bytes - 150 event.name = uid.name;
151 last_uids[uid.uid].io[UID_BACKGROUND].write_bytes; 151 event.fg_read_bytes = uid.io[UID_FOREGROUND].read_bytes -
152 152 last_uids[uid.uid].io[UID_FOREGROUND].read_bytes;;
153 if (bg_read_delta + bg_write_delta >= adjusted_threshold) { 153 event.fg_write_bytes = uid.io[UID_FOREGROUND].write_bytes -
154 struct uid_event event; 154 last_uids[uid.uid].io[UID_FOREGROUND].write_bytes;;
155 event.name = uid.name; 155 event.bg_read_bytes = uid.io[UID_BACKGROUND].read_bytes -
156 event.read_bytes = bg_read_delta; 156 last_uids[uid.uid].io[UID_BACKGROUND].read_bytes;;
157 event.write_bytes = bg_write_delta; 157 event.bg_write_bytes = uid.io[UID_BACKGROUND].write_bytes -
158 event.interval = uint64_t(ts_delta / NS_PER_SEC); 158 last_uids[uid.uid].io[UID_BACKGROUND].write_bytes;;
159 add_event(event); 159 event.interval = uint64_t(ts_delta / NS_PER_SEC);
160 160
161 android_log_event_list(EVENTLOGTAG_UID_IO_ALERT) 161 add_event(event);
162 << uid.name << bg_read_delta << bg_write_delta
163 << uint64_t(ts_delta / NS_PER_SEC) << LOG_ID_EVENTS;
164 }
165 } 162 }
166 163
167 set_last_uids(std::move(uids), curr_ts); 164 set_last_uids(std::move(uids), curr_ts);