diff options
author | David Anderson <dvander@google.com> | 2018-07-26 14:30:35 -0700 |
---|---|---|
committer | David Anderson <dvander@google.com> | 2018-08-21 09:20:33 -0700 |
commit | 0026a14ff2655fa1b5c77e00e58e0f3dceed2d87 (patch) | |
tree | ee5673b25069e6cf57a9f0bc84cb3e7180d20704 /storaged/include | |
parent | 3488d9f9ddd19655511ccd8782f45e4b630ba8d2 (diff) | |
download | system_core-0026a14ff2655fa1b5c77e00e58e0f3dceed2d87.tar.gz system_core-0026a14ff2655fa1b5c77e00e58e0f3dceed2d87.tar.bz2 system_core-0026a14ff2655fa1b5c77e00e58e0f3dceed2d87.zip |
storaged: Don't duplicate uid_records from proto files.
It is possible for storaged to load the same saved proto file multiple
times, for example, if system_server crashes. In this case we do not
want to fill io_history with duplicate entries. This patch elides
records for which an app+userid record already exists for the same
timestamp.
Bug: 111578975
Test: gtest storaged_test.load_uid_io_proto
Change-Id: I87bc3e37d6464079cece03b5852285d79067b935
Merged-In: I87bc3e37d6464079cece03b5852285d79067b935
Diffstat (limited to 'storaged/include')
-rw-r--r-- | storaged/include/storaged_uid_monitor.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/storaged/include/storaged_uid_monitor.h b/storaged/include/storaged_uid_monitor.h index b56e71aac..0c03402a0 100644 --- a/storaged/include/storaged_uid_monitor.h +++ b/storaged/include/storaged_uid_monitor.h @@ -79,6 +79,8 @@ struct uid_records { class uid_monitor { private: FRIEND_TEST(storaged_test, uid_monitor); + FRIEND_TEST(storaged_test, load_uid_io_proto); + // last dump from /proc/uid_io/stats, uid -> uid_info unordered_map<uint32_t, uid_info> last_uid_io_stats_; // current io usage for next report, app name -> uid_io_usage @@ -118,7 +120,7 @@ public: bool enabled() { return enabled_; }; void report(unordered_map<int, StoragedProto>* protos); // restores io_history from protobuf - void load_uid_io_proto(const UidIOUsage& proto); + void load_uid_io_proto(userid_t user_id, const UidIOUsage& proto); void clear_user_history(userid_t user_id); map<uint64_t, uid_records>& io_history() { return io_history_; } |