diff --git a/README.md b/README.md index 239ba2b..3cd112b 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ Print CPU and GPU temperatures on macOS. It works on following macs. +- arm64 (M5 mac) - arm64 (M4 mac) - arm64 (M3 mac) - arm64 (M2 mac) diff --git a/smctemp.cc b/smctemp.cc index dbb2e8e..cf57f12 100644 --- a/smctemp.cc +++ b/smctemp.cc @@ -465,7 +465,29 @@ double SmcTemp::GetCpuTemp() { const std::pair valid_temperature_limits{10, 120}; const std::string cpumodel = getCPUModel(); - if (cpumodel.find("m4") != std::string::npos) { // Apple M4 + if (cpumodel.find("m5") != std::string::npos) { // Apple M5 + // ref: https://github.com/exelban/stats/blob/ab28d72/Modules/Sensors/values.swift#L469-L487 + // CPU super cores + sensors.emplace_back(static_cast(kSensorTp00)); + sensors.emplace_back(static_cast(kSensorTp04)); + sensors.emplace_back(static_cast(kSensorTp08)); + sensors.emplace_back(static_cast(kSensorTp0C)); + sensors.emplace_back(static_cast(kSensorTp0G)); + sensors.emplace_back(static_cast(kSensorTp0K)); + // CPU performance cores + sensors.emplace_back(static_cast(kSensorTp0O)); + sensors.emplace_back(static_cast(kSensorTp0R)); + sensors.emplace_back(static_cast(kSensorTp0U)); + sensors.emplace_back(static_cast(kSensorTp0X)); + sensors.emplace_back(static_cast(kSensorTp0a)); + sensors.emplace_back(static_cast(kSensorTp0d)); + sensors.emplace_back(static_cast(kSensorTp0g)); + sensors.emplace_back(static_cast(kSensorTp0j)); + sensors.emplace_back(static_cast(kSensorTp0m)); + sensors.emplace_back(static_cast(kSensorTp0p)); + sensors.emplace_back(static_cast(kSensorTp0u)); + sensors.emplace_back(static_cast(kSensorTp0y)); + } else if (cpumodel.find("m4") != std::string::npos) { // Apple M4 sensors.emplace_back(static_cast(kSensorTp01)); sensors.emplace_back(static_cast(kSensorTp09)); sensors.emplace_back(static_cast(kSensorTp0f)); @@ -577,7 +599,17 @@ double SmcTemp::GetGpuTemp() { std::vector sensors; const std::pair valid_temperature_limits{10, 120}; const std::string cpumodel = getCPUModel(); - if (cpumodel.find("m4") != std::string::npos) { // Apple M4 + if (cpumodel.find("m5") != std::string::npos) { // Apple M5 + // ref: https://github.com/exelban/stats/blob/ab28d72/Modules/Sensors/values.swift#L489-L496 + sensors.emplace_back(static_cast(kSensorTg0U)); // GPU 1 + sensors.emplace_back(static_cast(kSensorTg0X)); // GPU 2 + sensors.emplace_back(static_cast(kSensorTg0d)); // GPU 3 + sensors.emplace_back(static_cast(kSensorTg0g)); // GPU 4 + sensors.emplace_back(static_cast(kSensorTg0j)); // GPU 5 + sensors.emplace_back(static_cast(kSensorTg1Y)); // GPU 6 + sensors.emplace_back(static_cast(kSensorTg1c)); // GPU 7 + sensors.emplace_back(static_cast(kSensorTg1g)); // GPU 8 + } else if (cpumodel.find("m4") != std::string::npos) { // Apple M4 sensors.emplace_back(static_cast(kSensorTg0D)); // GPU 1 sensors.emplace_back(static_cast(kSensorTg0P)); // GPU 2 sensors.emplace_back(static_cast(kSensorTg0X)); // GPU 3 diff --git a/smctemp.h b/smctemp.h index 74af60e..6952f10 100644 --- a/smctemp.h +++ b/smctemp.h @@ -62,20 +62,36 @@ constexpr UInt32Char_t kSensorTc0a = "Tc0a"; constexpr UInt32Char_t kSensorTc0b = "Tc0b"; constexpr UInt32Char_t kSensorTc0x = "Tc0x"; constexpr UInt32Char_t kSensorTc0z = "Tc0z"; +constexpr UInt32Char_t kSensorTp00 = "Tp00"; constexpr UInt32Char_t kSensorTp01 = "Tp01"; +constexpr UInt32Char_t kSensorTp04 = "Tp04"; constexpr UInt32Char_t kSensorTp05 = "Tp05"; +constexpr UInt32Char_t kSensorTp08 = "Tp08"; constexpr UInt32Char_t kSensorTp09 = "Tp09"; +constexpr UInt32Char_t kSensorTp0C = "Tp0C"; constexpr UInt32Char_t kSensorTp0D = "Tp0D"; +constexpr UInt32Char_t kSensorTp0G = "Tp0G"; constexpr UInt32Char_t kSensorTp0H = "Tp0H"; +constexpr UInt32Char_t kSensorTp0K = "Tp0K"; constexpr UInt32Char_t kSensorTp0L = "Tp0L"; +constexpr UInt32Char_t kSensorTp0O = "Tp0O"; constexpr UInt32Char_t kSensorTp0P = "Tp0P"; +constexpr UInt32Char_t kSensorTp0R = "Tp0R"; constexpr UInt32Char_t kSensorTp0T = "Tp0T"; +constexpr UInt32Char_t kSensorTp0U = "Tp0U"; constexpr UInt32Char_t kSensorTp0X = "Tp0X"; +constexpr UInt32Char_t kSensorTp0a = "Tp0a"; constexpr UInt32Char_t kSensorTp0b = "Tp0b"; +constexpr UInt32Char_t kSensorTp0d = "Tp0d"; constexpr UInt32Char_t kSensorTp0f = "Tp0f"; +constexpr UInt32Char_t kSensorTp0g = "Tp0g"; constexpr UInt32Char_t kSensorTp0j = "Tp0j"; +constexpr UInt32Char_t kSensorTp0m = "Tp0m"; constexpr UInt32Char_t kSensorTp0n = "Tp0n"; +constexpr UInt32Char_t kSensorTp0p = "Tp0p"; constexpr UInt32Char_t kSensorTp0r = "Tp0r"; +constexpr UInt32Char_t kSensorTp0u = "Tp0u"; +constexpr UInt32Char_t kSensorTp0y = "Tp0y"; constexpr UInt32Char_t kSensorTp1h = "Tp1h"; constexpr UInt32Char_t kSensorTp1t = "Tp1t"; constexpr UInt32Char_t kSensorTp1p = "Tp1p"; @@ -86,12 +102,18 @@ constexpr UInt32Char_t kSensorTg0D = "Tg0D"; constexpr UInt32Char_t kSensorTg0L = "Tg0L"; constexpr UInt32Char_t kSensorTg0P = "Tg0P"; constexpr UInt32Char_t kSensorTg0T = "Tg0T"; +constexpr UInt32Char_t kSensorTg0U = "Tg0U"; constexpr UInt32Char_t kSensorTg0X = "Tg0X"; constexpr UInt32Char_t kSensorTg0b = "Tg0b"; +constexpr UInt32Char_t kSensorTg0d = "Tg0d"; constexpr UInt32Char_t kSensorTg0f = "Tg0f"; +constexpr UInt32Char_t kSensorTg0g = "Tg0g"; constexpr UInt32Char_t kSensorTg0j = "Tg0j"; constexpr UInt32Char_t kSensorTg0v = "Tg0v"; +constexpr UInt32Char_t kSensorTg1Y = "Tg1Y"; constexpr UInt32Char_t kSensorTg1b = "Tg1b"; +constexpr UInt32Char_t kSensorTg1c = "Tg1c"; +constexpr UInt32Char_t kSensorTg1g = "Tg1g"; constexpr UInt32Char_t kSensorTg4b = "Tg4b"; #endif