summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJin Qian2017-08-02 19:37:40 -0500
committerJin Qian2017-08-03 12:28:52 -0500
commitccae2b5779e01e885bd7c85e314a2f8f523c4b94 (patch)
tree17b13cf4a75c94db03770c5796e246b38898b274 /storaged
parent3bb2dfd252a2e74b8c0d61fafd59fcf9b633f6dd (diff)
downloadplatform-system-core-ccae2b5779e01e885bd7c85e314a2f8f523c4b94.tar.gz
platform-system-core-ccae2b5779e01e885bd7c85e314a2f8f523c4b94.tar.xz
platform-system-core-ccae2b5779e01e885bd7c85e314a2f8f523c4b94.zip
storaged: fix excessive accounting when io usage has negative delta
When current io bytes are smaller than previous bytes, add 0 to delta instead of adding current io bytes. Bug: 64317562 Merged-In: If0c9814892ad61b790baa6395649af10b11d5b7c Change-Id: I1ffd7ac33649ab3b8405c83b1328fa9bf49702c0
Diffstat (limited to 'storaged')
-rw-r--r--storaged/storaged_uid_monitor.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/storaged/storaged_uid_monitor.cpp b/storaged/storaged_uid_monitor.cpp
index 5bb98e1e8..dd398b5ca 100644
--- a/storaged/storaged_uid_monitor.cpp
+++ b/storaged/storaged_uid_monitor.cpp
@@ -228,13 +228,13 @@ void uid_monitor::update_curr_io_stats_locked()
228 last_uid_io_stats[uid.uid].io[BACKGROUND].write_bytes; 228 last_uid_io_stats[uid.uid].io[BACKGROUND].write_bytes;
229 229
230 usage.bytes[READ][FOREGROUND][charger_stat] += 230 usage.bytes[READ][FOREGROUND][charger_stat] +=
231 (fg_rd_delta < 0) ? uid.io[FOREGROUND].read_bytes : fg_rd_delta; 231 (fg_rd_delta < 0) ? 0 : fg_rd_delta;
232 usage.bytes[READ][BACKGROUND][charger_stat] += 232 usage.bytes[READ][BACKGROUND][charger_stat] +=
233 (bg_rd_delta < 0) ? uid.io[BACKGROUND].read_bytes : bg_rd_delta; 233 (bg_rd_delta < 0) ? 0 : bg_rd_delta;
234 usage.bytes[WRITE][FOREGROUND][charger_stat] += 234 usage.bytes[WRITE][FOREGROUND][charger_stat] +=
235 (fg_wr_delta < 0) ? uid.io[FOREGROUND].write_bytes : fg_wr_delta; 235 (fg_wr_delta < 0) ? 0 : fg_wr_delta;
236 usage.bytes[WRITE][BACKGROUND][charger_stat] += 236 usage.bytes[WRITE][BACKGROUND][charger_stat] +=
237 (bg_wr_delta < 0) ? uid.io[BACKGROUND].write_bytes : bg_wr_delta; 237 (bg_wr_delta < 0) ? 0 : bg_wr_delta;
238 } 238 }
239 239
240 last_uid_io_stats = uid_io_stats; 240 last_uid_io_stats = uid_io_stats;