blob: 62cb12d1cc924d162e1ce9d6a41b16b5f5160e7a [file] [log] [blame]
ynwang62cb3722016-06-17 14:30:48 -07001/*
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 Qianb049d182017-10-12 17:02:17 -070027using namespace android::os::storaged;
28
ynwang62cb3722016-06-17 14:30:48 -070029// Diskstats
30bool parse_disk_stats(const char* disk_stats_path, struct disk_stats* stats);
31struct disk_perf get_disk_perf(struct disk_stats* stats);
Jin Qian65dea712017-08-29 16:48:20 -070032void get_inc_disk_stats(const struct disk_stats* prev, const struct disk_stats* curr, struct disk_stats* inc);
ynwang62cb3722016-06-17 14:30:48 -070033void add_disk_stats(struct disk_stats* src, struct disk_stats* dst);
ynwang62cb3722016-06-17 14:30:48 -070034
Jin Qianbcd6e3b2016-12-28 15:43:51 -080035// UID I/O
Jin Qian6df3bc62017-10-18 17:52:14 -070036map<string, io_usage> merge_io_usage(const vector<uid_record>& entries);
Jin Qianb049d182017-10-12 17:02:17 -070037void sort_running_uids_info(std::vector<UidInfo> &uids);
ynwang62cb3722016-06-17 14:30:48 -070038
39// Logging
Jin Qianb049d182017-10-12 17:02:17 -070040void log_console_running_uids_info(const std::vector<UidInfo>& uids, bool flag_dump_task);
41void log_console_perf_history(const vector<int>& perf_history);
Jin Qian27506fa2017-01-17 11:51:51 -080042
Jin Qianbcd6e3b2016-12-28 15:43:51 -080043#endif /* _STORAGED_UTILS_H_ */