summaryrefslogtreecommitdiffstats
path: root/storaged/include
diff options
context:
space:
mode:
authorJin Qian <jinqian@google.com>2017-02-21 12:09:39 -0800
committerJin Qian <jinqian@google.com>2017-02-21 15:33:22 -0800
commit8157775d791c124fcd84cdbeb7a751226bcb285b (patch)
treeafa078019b4535ac95db7314da29cde82e752fea /storaged/include
parentfba6f2622ff06995b7668926ea32b877a36dc077 (diff)
downloadsystem_core-8157775d791c124fcd84cdbeb7a751226bcb285b.tar.gz
system_core-8157775d791c124fcd84cdbeb7a751226bcb285b.tar.bz2
system_core-8157775d791c124fcd84cdbeb7a751226bcb285b.zip
storaged: include start time in IO usage dumpsys
New format: starttime1,endtime1 records [starttime2],endtime2 records Note starttime2 is skipped if it equals with endtime1. Bug: 34198239 Change-Id: I8a88a3bf1d50e065510d3ab123422d564fb6159f
Diffstat (limited to 'storaged/include')
-rw-r--r--storaged/include/storaged.h2
-rw-r--r--storaged/include/storaged_uid_monitor.h13
2 files changed, 11 insertions, 4 deletions
diff --git a/storaged/include/storaged.h b/storaged/include/storaged.h
index 591719e74..c291bd98c 100644
--- a/storaged/include/storaged.h
+++ b/storaged/include/storaged.h
@@ -301,7 +301,7 @@ public:
std::unordered_map<uint32_t, struct uid_info> get_uids(void) {
return mUidm.get_uid_io_stats();
}
- std::map<uint64_t, std::vector<struct uid_record>> get_uid_records(
+ std::map<uint64_t, struct uid_records> get_uid_records(
double hours, uint64_t threshold, bool force_report) {
return mUidm.dump(hours, threshold, force_report);
}
diff --git a/storaged/include/storaged_uid_monitor.h b/storaged/include/storaged_uid_monitor.h
index 031b7c4ee..b32c9a095 100644
--- a/storaged/include/storaged_uid_monitor.h
+++ b/storaged/include/storaged_uid_monitor.h
@@ -63,18 +63,25 @@ struct uid_record {
struct uid_io_usage ios;
};
+struct uid_records {
+ uint64_t start_ts;
+ std::vector<struct uid_record> entries;
+};
+
class uid_monitor {
private:
// last dump from /proc/uid_io/stats, uid -> uid_info
std::unordered_map<uint32_t, struct uid_info> last_uid_io_stats;
// current io usage for next report, app name -> uid_io_usage
std::unordered_map<std::string, struct uid_io_usage> curr_io_stats;
- // io usage records, timestamp -> vector of events
- std::map<uint64_t, std::vector<struct uid_record>> records;
+ // io usage records, end timestamp -> {start timestamp, vector of records}
+ std::map<uint64_t, struct uid_records> records;
// charger ON/OFF
charger_stat_t charger_stat;
// protects curr_io_stats, last_uid_io_stats, records and charger_stat
sem_t um_lock;
+ // start time for IO records
+ uint64_t start_ts;
// reads from /proc/uid_io/stats
std::unordered_map<uint32_t, struct uid_info> get_uid_io_stats_locked();
@@ -91,7 +98,7 @@ public:
// called by storaged -u
std::unordered_map<uint32_t, struct uid_info> get_uid_io_stats();
// called by dumpsys
- std::map<uint64_t, std::vector<struct uid_record>> dump(
+ std::map<uint64_t, struct uid_records> dump(
double hours, uint64_t threshold, bool force_report);
// called by battery properties listener
void set_charger_state(charger_stat_t stat);