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

Issue 2823583002: chromeos: Add CPU temperature reader (Closed)

Created:
3 years, 8 months ago by Simon Que
Modified:
3 years, 8 months ago
Reviewers:
stevenjb, Daniel Erat
CC:
chromium-reviews, oshima+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

chromeos: Add CPU temperature reader Reads from hwmon in sysfs. This does the same thing as ReadCPUTempInfo() in chrome/browser/chromeos/policy/device_status_collector.cc, but it is available to the rest of Chrome. BUG=chromium:709102 Review-Url: https://codereview.chromium.org/2823583002 Cr-Commit-Position: refs/heads/master@{#466858} Committed: https://chromium.googlesource.com/chromium/src/+/745fad9fe0f68a795a191a32cb038d864bfc2dbf

Patch Set 1 #

Total comments: 10

Patch Set 2 : Factor out temp and label reading; Add class and unit test #

Total comments: 9

Patch Set 3 : Rename to cpu_temperature_reader; Move struct into class #

Patch Set 4 : Make runnable on main UI thread #

Total comments: 22

Patch Set 5 : Applied derat's feedback #

Patch Set 6 : Turn back into a blocking operation #

Patch Set 7 : Handle trailing newline in sysfs #

Total comments: 32

Patch Set 8 : Answered derat's feedback #

Total comments: 4

Patch Set 9 : Change hwmon_dir_ to FilePath; Remove empty path check #

Total comments: 2

Patch Set 10 : set_hwmon_dir_for_test takes FilePath arg #

Total comments: 2

Patch Set 11 : one last fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+316 lines, -0 lines) Patch
M chromeos/BUILD.gn View 1 2 2 chunks +3 lines, -0 lines 0 comments Download
A chromeos/system/cpu_temperature_reader.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +60 lines, -0 lines 0 comments Download
A chromeos/system/cpu_temperature_reader.cc View 1 2 3 4 5 6 7 8 1 chunk +117 lines, -0 lines 0 comments Download
A chromeos/system/cpu_temperature_reader_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +136 lines, -0 lines 0 comments Download

Messages

Total messages: 47 (10 generated)
Simon Que
3 years, 8 months ago (2017-04-14 14:01:44 UTC) #2
Simon Que
On 2017/04/14 14:01:44, Simon Que wrote: I am not sure if this needs a unit ...
3 years, 8 months ago (2017-04-14 14:03:56 UTC) #3
stevenjb
Moving this code to src/chromeos makes sense, but since we are only moving part of ...
3 years, 8 months ago (2017-04-14 15:44:04 UTC) #4
Daniel Erat
agreed re putting this in a class. you don't really need a delegate interface, though ...
3 years, 8 months ago (2017-04-14 18:53:32 UTC) #5
Simon Que
https://codereview.chromium.org/2823583002/diff/1/chromeos/system/cpu_temp_reader.cc File chromeos/system/cpu_temp_reader.cc (right): https://codereview.chromium.org/2823583002/diff/1/chromeos/system/cpu_temp_reader.cc#newcode48 chromeos/system/cpu_temp_reader.cc:48: } On 2017/04/14 15:44:04, stevenjb wrote: > This would ...
3 years, 8 months ago (2017-04-17 16:41:07 UTC) #6
stevenjb
https://codereview.chromium.org/2823583002/diff/20001/chromeos/system/cpu_temp_reader.h File chromeos/system/cpu_temp_reader.h (right): https://codereview.chromium.org/2823583002/diff/20001/chromeos/system/cpu_temp_reader.h#newcode18 chromeos/system/cpu_temp_reader.h:18: struct CPUTemperatureInfo { Make this a member of the ...
3 years, 8 months ago (2017-04-17 16:49:00 UTC) #7
Simon Que
https://codereview.chromium.org/2823583002/diff/20001/chromeos/system/cpu_temp_reader.h File chromeos/system/cpu_temp_reader.h (right): https://codereview.chromium.org/2823583002/diff/20001/chromeos/system/cpu_temp_reader.h#newcode18 chromeos/system/cpu_temp_reader.h:18: struct CPUTemperatureInfo { On 2017/04/17 16:49:00, stevenjb wrote: > ...
3 years, 8 months ago (2017-04-17 17:07:48 UTC) #9
stevenjb
https://codereview.chromium.org/2823583002/diff/20001/chromeos/system/cpu_temp_reader.h File chromeos/system/cpu_temp_reader.h (right): https://codereview.chromium.org/2823583002/diff/20001/chromeos/system/cpu_temp_reader.h#newcode41 chromeos/system/cpu_temp_reader.h:41: // function can choose to call it from a ...
3 years, 8 months ago (2017-04-17 17:24:40 UTC) #10
Simon Que
On 2017/04/17 17:24:40, stevenjb wrote: > https://codereview.chromium.org/2823583002/diff/20001/chromeos/system/cpu_temp_reader.h > File chromeos/system/cpu_temp_reader.h (right): > > https://codereview.chromium.org/2823583002/diff/20001/chromeos/system/cpu_temp_reader.h#newcode41 > ...
3 years, 8 months ago (2017-04-17 17:36:35 UTC) #11
stevenjb
https://cs.chromium.org/chromium/src/chromeos/dbus/session_manager_client.cc?type=cs&q=MayBlock+file:%5Esrc/chromeos/+package:%5Echromium$&l=890 On Mon, Apr 17, 2017 at 11:36 AM, <sque@chromium.org> wrote: > On 2017/04/17 17:24:40, ...
3 years, 8 months ago (2017-04-17 17:47:02 UTC) #12
Simon Que
On 2017/04/17 17:47:02, stevenjb wrote: > https://cs.chromium.org/chromium/src/chromeos/dbus/session_manager_client.cc?type=cs&q=MayBlock+file:%5Esrc/chromeos/+package:%5Echromium$&l=890 I'm still a bit confused here. I assume ...
3 years, 8 months ago (2017-04-18 14:31:58 UTC) #13
stevenjb
On 2017/04/18 14:31:58, Simon Que wrote: > On 2017/04/17 17:47:02, stevenjb wrote: > > > ...
3 years, 8 months ago (2017-04-18 15:44:01 UTC) #14
Simon Que
On 2017/04/18 15:44:01, stevenjb wrote: > On 2017/04/18 14:31:58, Simon Que wrote: > > On ...
3 years, 8 months ago (2017-04-18 16:14:56 UTC) #15
stevenjb
Create a callback that stores the results then call your method then call: base::RunLoop().RunUntilIdle(). Then ...
3 years, 8 months ago (2017-04-18 16:35:47 UTC) #16
Simon Que
On 2017/04/18 16:35:47, stevenjb wrote: > Create a callback that stores the results then call ...
3 years, 8 months ago (2017-04-20 20:51:53 UTC) #17
Daniel Erat
i didn't look at the tests yet https://codereview.chromium.org/2823583002/diff/80001/chromeos/system/cpu_temperature_reader.cc File chromeos/system/cpu_temperature_reader.cc (right): https://codereview.chromium.org/2823583002/diff/80001/chromeos/system/cpu_temperature_reader.cc#newcode22 chromeos/system/cpu_temperature_reader.cc:22: const char ...
3 years, 8 months ago (2017-04-20 21:23:53 UTC) #18
Simon Que
https://codereview.chromium.org/2823583002/diff/80001/chromeos/system/cpu_temperature_reader.cc File chromeos/system/cpu_temperature_reader.cc (right): https://codereview.chromium.org/2823583002/diff/80001/chromeos/system/cpu_temperature_reader.cc#newcode22 chromeos/system/cpu_temperature_reader.cc:22: const char kDefaultHwmonDir[] = "/sys/class/hwmon/"; On 2017/04/20 21:23:52, Daniel ...
3 years, 8 months ago (2017-04-21 08:52:26 UTC) #19
Simon Que
After reviewing where I would call this code elsewhere in Chrome, it makes more sense ...
3 years, 8 months ago (2017-04-21 09:32:44 UTC) #20
Daniel Erat
On 2017/04/21 09:32:44, Simon Que wrote: > After reviewing where I would call this code ...
3 years, 8 months ago (2017-04-21 14:15:57 UTC) #21
Simon Que
On Fri, Apr 21, 2017 at 4:15 PM, <derat@chromium.org> wrote: > On 2017/04/21 09:32:44, Simon ...
3 years, 8 months ago (2017-04-21 16:16:50 UTC) #22
stevenjb
base::OpenFile already calls ThreadRestrictions::AssertIOAllowed, so I don't think we need to explicitly check that here, ...
3 years, 8 months ago (2017-04-21 20:24:27 UTC) #23
Daniel Erat
https://codereview.chromium.org/2823583002/diff/140001/chromeos/system/cpu_temperature_reader.cc File chromeos/system/cpu_temperature_reader.cc (right): https://codereview.chromium.org/2823583002/diff/140001/chromeos/system/cpu_temperature_reader.cc#newcode39 chromeos/system/cpu_temperature_reader.cc:39: bool ReadTemperatureFromPath(const base::FilePath& path, nit: add a comment describing ...
3 years, 8 months ago (2017-04-21 21:01:21 UTC) #24
Simon Que
https://codereview.chromium.org/2823583002/diff/140001/chromeos/system/cpu_temperature_reader.cc File chromeos/system/cpu_temperature_reader.cc (right): https://codereview.chromium.org/2823583002/diff/140001/chromeos/system/cpu_temperature_reader.cc#newcode39 chromeos/system/cpu_temperature_reader.cc:39: bool ReadTemperatureFromPath(const base::FilePath& path, On 2017/04/21 21:01:20, Daniel Erat ...
3 years, 8 months ago (2017-04-24 13:59:18 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2823583002/160001
3 years, 8 months ago (2017-04-24 20:08:01 UTC) #28
Daniel Erat
https://codereview.chromium.org/2823583002/diff/160001/chromeos/system/cpu_temperature_reader.cc File chromeos/system/cpu_temperature_reader.cc (right): https://codereview.chromium.org/2823583002/diff/160001/chromeos/system/cpu_temperature_reader.cc#newcode107 chromeos/system/cpu_temperature_reader.cc:107: if (temperature_path.value().empty()) { what are you trying to catch ...
3 years, 8 months ago (2017-04-24 20:16:51 UTC) #29
Simon Que
https://codereview.chromium.org/2823583002/diff/160001/chromeos/system/cpu_temperature_reader.cc File chromeos/system/cpu_temperature_reader.cc (right): https://codereview.chromium.org/2823583002/diff/160001/chromeos/system/cpu_temperature_reader.cc#newcode107 chromeos/system/cpu_temperature_reader.cc:107: if (temperature_path.value().empty()) { On 2017/04/24 20:16:50, Daniel Erat wrote: ...
3 years, 8 months ago (2017-04-24 22:25:48 UTC) #31
Daniel Erat
https://codereview.chromium.org/2823583002/diff/180001/chromeos/system/cpu_temperature_reader.h File chromeos/system/cpu_temperature_reader.h (right): https://codereview.chromium.org/2823583002/diff/180001/chromeos/system/cpu_temperature_reader.h#newcode43 chromeos/system/cpu_temperature_reader.h:43: void set_hwmon_dir_for_test(const std::string& dir) { this should take a ...
3 years, 8 months ago (2017-04-24 22:29:43 UTC) #32
Simon Que
https://codereview.chromium.org/2823583002/diff/180001/chromeos/system/cpu_temperature_reader.h File chromeos/system/cpu_temperature_reader.h (right): https://codereview.chromium.org/2823583002/diff/180001/chromeos/system/cpu_temperature_reader.h#newcode43 chromeos/system/cpu_temperature_reader.h:43: void set_hwmon_dir_for_test(const std::string& dir) { On 2017/04/24 22:29:43, Daniel ...
3 years, 8 months ago (2017-04-24 22:31:41 UTC) #33
Daniel Erat
you need to re-upload
3 years, 8 months ago (2017-04-24 22:50:07 UTC) #34
Simon Que
Done. On Mon, Apr 24, 2017 at 6:50 PM, <derat@chromium.org> wrote: > you need to ...
3 years, 8 months ago (2017-04-24 22:51:15 UTC) #35
Daniel Erat
https://codereview.chromium.org/2823583002/diff/200001/chromeos/system/cpu_temperature_reader.h File chromeos/system/cpu_temperature_reader.h (right): https://codereview.chromium.org/2823583002/diff/200001/chromeos/system/cpu_temperature_reader.h#newcode44 chromeos/system/cpu_temperature_reader.h:44: hwmon_dir_ = base::FilePath(dir); don't call base::FilePath here now
3 years, 8 months ago (2017-04-24 22:59:24 UTC) #36
Simon Que
https://codereview.chromium.org/2823583002/diff/200001/chromeos/system/cpu_temperature_reader.h File chromeos/system/cpu_temperature_reader.h (right): https://codereview.chromium.org/2823583002/diff/200001/chromeos/system/cpu_temperature_reader.h#newcode44 chromeos/system/cpu_temperature_reader.h:44: hwmon_dir_ = base::FilePath(dir); On 2017/04/24 22:59:23, Daniel Erat wrote: ...
3 years, 8 months ago (2017-04-24 23:41:07 UTC) #37
Daniel Erat
lgtm
3 years, 8 months ago (2017-04-24 23:44:59 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2823583002/220001
3 years, 8 months ago (2017-04-25 00:34:35 UTC) #41
commit-bot: I haz the power
Committed patchset #11 (id:220001) as https://chromium.googlesource.com/chromium/src/+/745fad9fe0f68a795a191a32cb038d864bfc2dbf
3 years, 8 months ago (2017-04-25 01:38:45 UTC) #44
findit-for-me
A revert of this CL (patchset #11 id:220001) has been created in https://codereview.chromium.org/2836843004/ by findit-for-me@appspot.gserviceaccount.com. ...
3 years, 8 months ago (2017-04-25 02:29:57 UTC) #45
yhirano
3 years, 8 months ago (2017-04-25 05:04:23 UTC) #46
Message was sent while issue was closed.
A revert of this CL (patchset #11 id:220001) has been created in
https://codereview.chromium.org/2843433005/ by yhirano@chromium.org.

The reason for reverting is: This change causes a build error..

Powered by Google App Engine
This is Rietveld 408576698