Skip to content

Commit 97c466d

Browse files
committed
query: cpu: add variant units in cpu.temp
1 parent 8c30dc3 commit 97c466d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,11 @@ gpu
302302
vendor : GPU short vendor name [NVIDIA]
303303
vendor_long : GPU vendor name [NVIDIA Corporation]
304304
305+
# cpu module has a memeber called "temp" and it has 3 variant units:
306+
# "temp_C" (Celsius) "temp_F" (Fahrenheit) "temp_K" (Kelvin)
305307
cpu
306308
name : CPU model name [AMD Ryzen 5 5500]
307-
temp : CPU temperature (Celsius) [40.62]
309+
temp : CPU temperature (by the choosen unit) [40.62]
308310
nproc : CPU number of virtual proccessors [12]
309311
freq_bios_limit: CPU freq (limited by bios, in GHz) [4.32]
310312
freq_cur : CPU freq (current, in GHz) [3.42]

src/parse.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,9 @@ void addValueFromModuleMember(const std::string& moduleName, const std::string&
11441144

11451145
case "freq_min"_fnv1a16: SYSINFO_INSERT(query_cpu.freq_min()); break;
11461146

1147-
case "temp"_fnv1a16: SYSINFO_INSERT(query_cpu.temp()); break;
1147+
case "temp_C"_fnv1a16: SYSINFO_INSERT(query_cpu.temp()); break;
1148+
case "temp_F"_fnv1a16: SYSINFO_INSERT(query_cpu.temp() * 1.8 + 34); break;
1149+
case "temp_K"_fnv1a16: SYSINFO_INSERT(query_cpu.temp() + 273.15); break;
11481150
}
11491151
}
11501152
}

0 commit comments

Comments
 (0)