OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "ThermalManager.h" | 8 #include "ThermalManager.h" |
9 | 9 |
10 #include "SkOSFile.h" | 10 #include "SkOSFile.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 int32_t threshold) | 90 int32_t threshold) |
91 : fThermalZoneRoot(thermalZoneRoot) | 91 : fThermalZoneRoot(thermalZoneRoot) |
92 , fPointName(pointName) { | 92 , fPointName(pointName) { |
93 SkString fullPath(thermalZoneRoot); | 93 SkString fullPath(thermalZoneRoot); |
94 fullPath.appendf("/%s", pointName.c_str()); | 94 fullPath.appendf("/%s", pointName.c_str()); |
95 fPoint = OpenFileAndReadInt32(fullPath.c_str()); | 95 fPoint = OpenFileAndReadInt32(fullPath.c_str()); |
96 fBase = GetTemp(fThermalZoneRoot); | 96 fBase = GetTemp(fThermalZoneRoot); |
97 fThreshold = threshold; | 97 fThreshold = threshold; |
98 fDisabled = fBase + fThreshold >= fPoint; // We disable any trip point whic
h start off | 98 fDisabled = fBase + fThreshold >= fPoint; // We disable any trip point whic
h start off |
99 // triggered | 99 // triggered |
100 if (!fDisabled) { | |
101 SkDebugf("Trip point %s base - %d trip point-%d\n", fullPath.c_str(), | |
102 fBase, fPoint); | |
103 } | |
104 } | 100 } |
105 | 101 |
106 bool ThermalManager::TripPoint::willTrip() { | 102 bool ThermalManager::TripPoint::willTrip() { |
107 int32_t currentTemp = GetTemp(fThermalZoneRoot); | 103 int32_t currentTemp = GetTemp(fThermalZoneRoot); |
108 bool wouldTrip = !fDisabled && currentTemp + fThreshold >= fPoint; | 104 bool wouldTrip = !fDisabled && currentTemp + fThreshold >= fPoint; |
109 | 105 |
110 if (wouldTrip) { | 106 if (wouldTrip) { |
111 SkDebugf("%s/%s would trip {%d,%d,%d,%d}\n", fThermalZoneRoot.c_str(), | 107 SkDebugf("%s/%s would trip {%d,%d,%d,%d}\n", fThermalZoneRoot.c_str(), |
112 fPointName.c_str(), fBase, currentTemp, fPoint, fThreshold); | 108 fPointName.c_str(), fBase, currentTemp, fPoint, fThreshold); |
113 } | 109 } |
114 return wouldTrip; | 110 return wouldTrip; |
115 } | 111 } |
116 | 112 |
117 #endif | 113 #endif |
OLD | NEW |