ynwang | 62cb372 | 2016-06-17 14:30:48 -0700 | [diff] [blame] | 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 | |
Jin Qian | b049d18 | 2017-10-12 17:02:17 -0700 | [diff] [blame] | 27 | using namespace android::os::storaged; |
| 28 | |
ynwang | 62cb372 | 2016-06-17 14:30:48 -0700 | [diff] [blame] | 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); |
Jin Qian | 65dea71 | 2017-08-29 16:48:20 -0700 | [diff] [blame] | 32 | void get_inc_disk_stats(const struct disk_stats* prev, const struct disk_stats* curr, struct disk_stats* inc); |
ynwang | 62cb372 | 2016-06-17 14:30:48 -0700 | [diff] [blame] | 33 | void add_disk_stats(struct disk_stats* src, struct disk_stats* dst); |
ynwang | 62cb372 | 2016-06-17 14:30:48 -0700 | [diff] [blame] | 34 | |
Jin Qian | bcd6e3b | 2016-12-28 15:43:51 -0800 | [diff] [blame] | 35 | // UID I/O |
Jin Qian | 6df3bc6 | 2017-10-18 17:52:14 -0700 | [diff] [blame] | 36 | map<string, io_usage> merge_io_usage(const vector<uid_record>& entries); |
Jin Qian | b049d18 | 2017-10-12 17:02:17 -0700 | [diff] [blame] | 37 | void sort_running_uids_info(std::vector<UidInfo> &uids); |
ynwang | 62cb372 | 2016-06-17 14:30:48 -0700 | [diff] [blame] | 38 | |
| 39 | // Logging |
Jin Qian | b049d18 | 2017-10-12 17:02:17 -0700 | [diff] [blame] | 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); |
Jin Qian | 27506fa | 2017-01-17 11:51:51 -0800 | [diff] [blame] | 42 | |
Jin Qian | bcd6e3b | 2016-12-28 15:43:51 -0800 | [diff] [blame] | 43 | #endif /* _STORAGED_UTILS_H_ */ |