Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: tools/ThermalManager.h

Issue 1671573002: Create a thermal manager class and wire it in to nanobench behind a flag (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef ThermalManager_DEFINED
9 #define ThermalManager_DEFINED
10
11 #include "SkString.h"
12 #include "SkTArray.h"
13
14 #define USE_THERMAL_MANAGER defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FO R_UNIX)
djsollen 2016/02/05 04:54:15 It would be more clear to me if you wrote it somet
joshualitt 2016/02/05 13:50:20 Acknowledged.
joshualitt 2016/02/05 13:50:20 Acknowledged.
mtklein 2016/02/05 13:54:21 More than that, Derek's version is legal preproces
15
16 #if USE_THERMAL_MANAGER
17
18 /*
19 * This simple class monitors the thermal part of sysfs to ensure we don't trigg er thermal events
20 */
21
22 class ThermalManager {
23 public:
24 ThermalManager(int32_t threshold = 1);
25
26 bool coolOffIfNecessary(uint32_t sleepInterval = 10, uint32_t maxSleeps = 10 00);
djsollen 2016/02/05 04:54:15 can you document that the sleep interval is in sec
joshualitt 2016/02/05 13:50:20 Acknowledged.
27
28 private:
29 static int32_t OpenFileAndReadInt32(const char* path);
30
31 static int32_t GetTemp(SkString thermalZonePath) {
32 SkString temperatureFilePath(thermalZonePath);
33 temperatureFilePath.appendf("/temp");
34 return OpenFileAndReadInt32(temperatureFilePath.c_str());
35 }
36
37 struct TripPoint {
38 TripPoint(SkString thermalZoneRoot, SkString pointName, int32_t threshol d);
39
40 bool willTrip();
41
42 SkString fThermalZoneRoot;
43 SkString fPointName;
44 int32_t fBase;
45 int32_t fPoint;
46 int32_t fThreshold;
47 bool fDisabled;
48 };
49
50 SkTArray<TripPoint> fTripPoints;
51 };
52 #endif
53 #endif
OLDNEW
« no previous file with comments | « gyp/tools.gyp ('k') | tools/ThermalManager.cpp » ('j') | tools/ThermalManager.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698