1 /*
2  * Copyright 2023 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 #include "SessionValueEntry.h"
18 
19 #include <sstream>
20 
21 namespace aidl {
22 namespace google {
23 namespace hardware {
24 namespace power {
25 namespace impl {
26 namespace pixel {
27 
dump(std::ostream & os) const28 std::ostream &SessionValueEntry::dump(std::ostream &os) const {
29     auto timeNow = std::chrono::steady_clock::now();
30     os << "ID.Min.Act(" << idString;
31     if (votes) {
32         UclampRange uclampRange;
33         votes->getUclampRange(uclampRange, timeNow);
34         os << ", " << uclampRange.uclampMin;
35         os << "-" << uclampRange.uclampMax;
36     } else {
37         os << ", votes nullptr";
38     }
39     os << ", " << isActive;
40     auto totalFrames = hBoostModeDist.lightModeFrames + hBoostModeDist.moderateModeFrames +
41                        hBoostModeDist.severeModeFrames;
42     os << ", HBoost:"
43        << (totalFrames <= 0 ? 0 : (hBoostModeDist.lightModeFrames * 10000 / totalFrames / 100.0))
44        << "%-"
45        << (totalFrames <= 0 ? 0 : (hBoostModeDist.moderateModeFrames * 10000 / totalFrames / 100.0))
46        << "%-"
47        << (totalFrames <= 0 ? 0 : (hBoostModeDist.severeModeFrames * 10000 / totalFrames / 100.0))
48        << "%-" << totalFrames << ", ";
49     os << sessFrameBuckets.toString() << ", ";
50     return os;
51 }
52 
53 }  // namespace pixel
54 }  // namespace impl
55 }  // namespace power
56 }  // namespace hardware
57 }  // namespace google
58 }  // namespace aidl
59