blob: f620715dabd544260761e4d2d5fc643060a395a8 [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'Brien26de80f2019-06-11 13:49:19 -070029
30struct concurrent_time_t {
31 std::vector<uint64_t> active;
32 std::vector<std::vector<uint64_t>> policy;
33};
34
35std::optional<concurrent_time_t> getUidConcurrentTimes(uint32_t uid, bool retry = true);
36std::optional<std::unordered_map<uint32_t, concurrent_time_t>> getUidsConcurrentTimes();
37bool clearUidTimes(unsigned int uid);
Connor O'Brien57337192018-11-20 12:49:16 -080038
39} // namespace bpf
40} // namespace android