1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef _STORAGED_UTILS_H_ 18 #define _STORAGED_UTILS_H_ 19 20 #include <stdint.h> 21 #include <string> 22 #include <unordered_map> 23 #include <vector> 24 25 #include "storaged.h" 26 27 using namespace android::os::storaged; 28 29 // Diskstats 30 bool parse_disk_stats(const char* disk_stats_path, struct disk_stats* stats); 31 struct disk_perf get_disk_perf(struct disk_stats* stats); 32 void get_inc_disk_stats(const struct disk_stats* prev, const struct disk_stats* curr, struct disk_stats* inc); 33 void add_disk_stats(struct disk_stats* src, struct disk_stats* dst); 34 35 // UID I/O 36 map<string, io_usage> merge_io_usage(const vector<uid_record>& entries); 37 void sort_running_uids_info(std::vector<UidInfo> &uids); 38 39 // Logging 40 void log_console_running_uids_info(const std::vector<UidInfo>& uids, bool flag_dump_task); 41 void log_console_perf_history(const vector<int>& perf_history); 42 43 #endif /* _STORAGED_UTILS_H_ */ 44