blob: b7600f59e0245e4fcaeaa20bd6fb082801e548c2 [file] [log] [blame]
Connor O'Brien57337192018-11-20 12:49:16 -08001/*
2 * Copyright (C) 2018 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
Connor O'Briend250acc2019-01-23 17:21:41 -080017#pragma once
18
Connor O'Brien57337192018-11-20 12:49:16 -080019#include <unordered_map>
20#include <vector>
21
22namespace android {
23namespace bpf {
24
Connor O'Brien26de80f2019-06-11 13:49:19 -070025bool startTrackingUidTimes();
Connor O'Brienf03b6ae2019-06-05 18:03:12 -070026std::optional<std::vector<std::vector<uint64_t>>> getUidCpuFreqTimes(uint32_t uid);
27std::optional<std::unordered_map<uint32_t, std::vector<std::vector<uint64_t>>>>
28 getUidsCpuFreqTimes();
Connor O'Brien2a716a42020-01-31 18:51:56 -080029std::optional<std::unordered_map<uint32_t, std::vector<std::vector<uint64_t>>>>
30 getUidsUpdatedCpuFreqTimes(uint64_t *lastUpdate);
Connor O'Brien8f296eb2019-10-01 17:58:38 -070031std::optional<std::vector<std::vector<uint32_t>>> getCpuFreqs();
Connor O'Brien26de80f2019-06-11 13:49:19 -070032
33struct concurrent_time_t {
34 std::vector<uint64_t> active;
35 std::vector<std::vector<uint64_t>> policy;
36};
37
38std::optional<concurrent_time_t> getUidConcurrentTimes(uint32_t uid, bool retry = true);
39std::optional<std::unordered_map<uint32_t, concurrent_time_t>> getUidsConcurrentTimes();
Connor O'Brien2a716a42020-01-31 18:51:56 -080040std::optional<std::unordered_map<uint32_t, concurrent_time_t>>
41 getUidsUpdatedConcurrentTimes(uint64_t *lastUpdate);
Connor O'Brien26de80f2019-06-11 13:49:19 -070042bool clearUidTimes(unsigned int uid);
Connor O'Brien57337192018-11-20 12:49:16 -080043
44} // namespace bpf
45} // namespace android