diff options
| author | Giampaolo Rodola' <g.rodola@gmail.com> | 2013-04-27 18:35:10 +0200 |
|---|---|---|
| committer | Giampaolo Rodola' <g.rodola@gmail.com> | 2013-04-27 18:35:10 +0200 |
| commit | 7e31b67956dacb0e6b704d6e4c4b0fe37faebbed (patch) | |
| tree | 9dc4632689ff6100b36374bf53fefe936e0da5b8 /psutil/__init__.py | |
| parent | ad7fe470bce703165a233495a3daee1330489e3e (diff) | |
| download | psutil-cpu-temp.tar.gz | |
Issue 371: implement CPU temperature on Linux by parsing files in /sys/class/hwmon/hwmon0/temp1_*. It is probably incomplete compared to what we can get via lm-sensors though so care should be taken on whether adding this or not.cpu-temp
Diffstat (limited to 'psutil/__init__.py')
| -rw-r--r-- | psutil/__init__.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/psutil/__init__.py b/psutil/__init__.py index 1d03d8af..23a33c85 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -1273,6 +1273,22 @@ def get_users(): """ return _psplatform.get_system_users() +if sys.platform.startswith("linux"): + + def get_cpu_temp(fahrenheit=False): + """Return temperatures for each physical CPU installed on the + system as a list of namedtuple including the following fields: + + - name: CPU name + - temp: current temperature + - max: maximum temperature + - critical: temperature considered critical + + If fahrenheit == False values are expressed in Celsius. + Linux only and still experimental. + """ + return _psplatform.get_cpu_temp(fahrenheit) + # ===================================================================== # --- deprecated functions # ===================================================================== |
