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 // Diskstats 28 bool parse_disk_stats(const char* disk_stats_path, struct disk_stats* stats); 29 struct disk_perf get_disk_perf(struct disk_stats* stats); 30 struct disk_stats get_inc_disk_stats(struct disk_stats* prev, struct disk_stats* curr); 31 void add_disk_stats(struct disk_stats* src, struct disk_stats* dst); 32 bool parse_emmc_ecsd(int ext_csd_fd, struct emmc_info* info); 33 34 // UID I/O 35 void sort_running_uids_info(std::vector<struct uid_info> &uids); 36 37 // Logging 38 void log_console_running_uids_info(std::vector<struct uid_info> uids); 39 40 void log_debug_disk_perf(struct disk_perf* perf, const char* type); 41 42 void log_event_disk_stats(struct disk_stats* stats, const char* type); 43 void log_event_emmc_info(struct emmc_info* info_); 44 #endif /* _STORAGED_UTILS_H_ */ 45