• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #pragma once
2 
3 /*
4  * Copyright (C) 2021 The Android Open Source Project
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #include <array>
20 #include <sstream>
21 
22 #include "Model.h"
23 
24 namespace aidl {
25 namespace google {
26 namespace hardware {
27 namespace power {
28 namespace impl {
29 namespace pixel {
30 
31 class ICpuLoadReader {
32   public:
33     // Initialize reading, must be done before calling other methods.
34     // Work is not done in constructor as it accesses files.
35     virtual bool Init() = 0;
36     // Get the load of each CPU, since the last time this method was called.
37     virtual bool GetRecentCpuLoads(
38             std::array<double, NUM_CPU_CORES> *cpuCoreIdleTimesPercentage) = 0;
39     // Dump internal state to a string stream. Used for dumpsys.
40     virtual void DumpToStream(std::stringstream &stream) const = 0;
~ICpuLoadReader()41     virtual ~ICpuLoadReader() {}
42 };
43 
44 }  // namespace pixel
45 }  // namespace impl
46 }  // namespace power
47 }  // namespace hardware
48 }  // namespace google
49 }  // namespace aidl
50