mirror of
https://github.com/flightlessmango/MangoHud.git
synced 2024-11-16 00:13:00 +00:00
Show amdgpu junction and memory temp, if available
Added config parameter `gpu_junction_temp` and `gpu_mem_temp` Closes #841
This commit is contained in:
parent
1093de8c44
commit
d41a74ca1a
@ -318,7 +318,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu
|
||||
| `cpu_load_value` | Set the values for medium and high load e.g `cpu_load_value=50,90` |
|
||||
| `cpu_mhz` | Show the CPUs current MHz |
|
||||
| `cpu_power`<br>`gpu_power` | Display CPU/GPU draw in watts |
|
||||
| `cpu_temp`<br>`gpu_temp` | Display current CPU/GPU temperature |
|
||||
| `cpu_temp`<br>`gpu_temp`<br>`gpu_junction_temp`<br>`gpu_mem_temp` | Display current CPU/GPU temperature |
|
||||
| `cpu_text`<br>`gpu_text` | Override CPU and GPU text |
|
||||
| `custom_text_center` | Display a custom text centered useful for a header e.g `custom_text_center=FlightLessMango Benchmarks` |
|
||||
| `custom_text` | Display a custom text e.g `custom_text=Fsync enabled` |
|
||||
|
@ -53,10 +53,12 @@
|
||||
# version
|
||||
|
||||
### Display the current GPU information
|
||||
## Note: gpu_mem_clock also needs "vram" to be enabled
|
||||
## Note: gpu_mem_clock and gpu_mem_temp also need "vram" to be enabled
|
||||
gpu_stats
|
||||
# gpu_temp
|
||||
# gpu_junction_temp
|
||||
# gpu_core_clock
|
||||
# gpu_mem_temp
|
||||
# gpu_mem_clock
|
||||
# gpu_power
|
||||
# gpu_text=GPU
|
||||
|
20
src/gpu.cpp
20
src/gpu.cpp
@ -138,7 +138,7 @@ void getAmdGpuInfo(){
|
||||
gpu_info.memoryUsed = float(value) / (1024 * 1024 * 1024);
|
||||
}
|
||||
// On some GPUs SMU can sometimes return the wrong temperature.
|
||||
// As HWMON is way more visible than the SMU metrics, let's always trust it as it is the most likely to work
|
||||
// As HWMON is way more visible than the SMU metrics, let's always trust it as it is the most likely to work
|
||||
if (amdgpu.temp){
|
||||
rewind(amdgpu.temp);
|
||||
fflush(amdgpu.temp);
|
||||
@ -148,6 +148,24 @@ void getAmdGpuInfo(){
|
||||
gpu_info.temp = value / 1000;
|
||||
}
|
||||
|
||||
if (amdgpu.junction_temp){
|
||||
rewind(amdgpu.junction_temp);
|
||||
fflush(amdgpu.junction_temp);
|
||||
int value = 0;
|
||||
if (fscanf(amdgpu.junction_temp, "%d", &value) != 1)
|
||||
value = 0;
|
||||
gpu_info.junction_temp = value / 1000;
|
||||
}
|
||||
|
||||
if (amdgpu.memory_temp){
|
||||
rewind(amdgpu.memory_temp);
|
||||
fflush(amdgpu.memory_temp);
|
||||
int value = 0;
|
||||
if (fscanf(amdgpu.memory_temp, "%d", &value) != 1)
|
||||
value = 0;
|
||||
gpu_info.memory_temp = value / 1000;
|
||||
}
|
||||
|
||||
if (amdgpu.gtt_used) {
|
||||
rewind(amdgpu.gtt_used);
|
||||
fflush(amdgpu.gtt_used);
|
||||
|
@ -13,6 +13,8 @@ struct amdgpu_files
|
||||
/* The following can be NULL, in that case we're using the gpu_metrics node */
|
||||
FILE *busy;
|
||||
FILE *temp;
|
||||
FILE *junction_temp;
|
||||
FILE *memory_temp;
|
||||
FILE *core_clock;
|
||||
FILE *memory_clock;
|
||||
FILE *power_usage;
|
||||
@ -25,6 +27,8 @@ extern amdgpu_files amdgpu;
|
||||
struct gpuInfo{
|
||||
int load;
|
||||
int temp;
|
||||
int junction_temp {-1};
|
||||
int memory_temp {-1};
|
||||
float memoryUsed;
|
||||
float memoryTotal;
|
||||
int MemClock;
|
||||
|
@ -172,6 +172,7 @@ void HudElements::gpu_stats(){
|
||||
// ImGui::SameLine(150);
|
||||
// ImGui::Text("%s", "%");
|
||||
}
|
||||
|
||||
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_gpu_temp]){
|
||||
ImguiNextColumnOrNewRow();
|
||||
right_aligned_text(text_color, HUDElements.ralign_width, "%i", gpu_info.temp);
|
||||
@ -181,6 +182,18 @@ void HudElements::gpu_stats(){
|
||||
else
|
||||
ImGui::Text("°C");
|
||||
}
|
||||
|
||||
if (gpu_info.junction_temp > -1 && HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_gpu_junction_temp]) {
|
||||
ImguiNextColumnOrNewRow();
|
||||
right_aligned_text(text_color, HUDElements.ralign_width, "%i", gpu_info.junction_temp);
|
||||
ImGui::SameLine(0, 1.0f);
|
||||
ImGui::Text("°C");
|
||||
ImGui::SameLine(0, 1.0f);
|
||||
ImGui::PushFont(HUDElements.sw_stats->font1);
|
||||
ImGui::Text("Jnc");
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_gpu_fan] && cpuStats.cpu_type != "APU"){
|
||||
ImguiNextColumnOrNewRow();
|
||||
right_aligned_text(text_color, HUDElements.ralign_width, "%i", gpu_info.fan_speed);
|
||||
@ -189,6 +202,7 @@ void HudElements::gpu_stats(){
|
||||
ImGui::Text("RPM");
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_gpu_core_clock]){
|
||||
ImguiNextColumnOrNewRow();
|
||||
right_aligned_text(text_color, HUDElements.ralign_width, "%i", gpu_info.CoreClock);
|
||||
@ -197,6 +211,7 @@ void HudElements::gpu_stats(){
|
||||
ImGui::Text("MHz");
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_gpu_power]) {
|
||||
ImguiNextColumnOrNewRow();
|
||||
char str[16];
|
||||
@ -370,6 +385,14 @@ void HudElements::vram(){
|
||||
ImGui::PushFont(HUDElements.sw_stats->font1);
|
||||
ImGui::Text("GiB");
|
||||
ImGui::PopFont();
|
||||
|
||||
if (gpu_info.memory_temp > -1 && HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_gpu_mem_temp]) {
|
||||
ImguiNextColumnOrNewRow();
|
||||
right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%i", gpu_info.memory_temp);
|
||||
ImGui::SameLine(0, 1.0f);
|
||||
ImGui::Text("°C");
|
||||
}
|
||||
|
||||
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_gpu_mem_clock]){
|
||||
ImguiNextColumnOrNewRow();
|
||||
right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%i", gpu_info.MemClock);
|
||||
|
@ -772,9 +772,14 @@ void init_gpu_stats(uint32_t& vendorID, uint32_t reported_deviceID, overlay_para
|
||||
|
||||
const std::string hwmon_path = device_path + "/hwmon/";
|
||||
const auto dirs = ls(hwmon_path.c_str(), "hwmon", LS_DIRS);
|
||||
for (const auto& dir : dirs)
|
||||
for (const auto& dir : dirs) {
|
||||
if (!amdgpu.temp)
|
||||
amdgpu.temp = fopen((hwmon_path + dir + "/temp1_input").c_str(), "r");
|
||||
if (!amdgpu.junction_temp)
|
||||
amdgpu.junction_temp = fopen((hwmon_path + dir + "/temp2_input").c_str(), "r");
|
||||
if (!amdgpu.memory_temp)
|
||||
amdgpu.memory_temp = fopen((hwmon_path + dir + "/temp3_input").c_str(), "r");
|
||||
}
|
||||
|
||||
if (!metrics_path.empty())
|
||||
break;
|
||||
|
@ -591,6 +591,8 @@ parse_overlay_config(struct overlay_params *params,
|
||||
params->enabled[OVERLAY_PARAM_ENABLED_cpu_temp] = false;
|
||||
params->enabled[OVERLAY_PARAM_ENABLED_cpu_power] = false;
|
||||
params->enabled[OVERLAY_PARAM_ENABLED_gpu_temp] = false;
|
||||
params->enabled[OVERLAY_PARAM_ENABLED_gpu_junction_temp] = false;
|
||||
params->enabled[OVERLAY_PARAM_ENABLED_gpu_mem_temp] = false;
|
||||
params->enabled[OVERLAY_PARAM_ENABLED_cpu_stats] = true;
|
||||
params->enabled[OVERLAY_PARAM_ENABLED_gpu_stats] = true;
|
||||
params->enabled[OVERLAY_PARAM_ENABLED_ram] = false;
|
||||
|
@ -31,6 +31,8 @@ typedef unsigned long KeySym;
|
||||
OVERLAY_PARAM_BOOL(cpu_temp) \
|
||||
OVERLAY_PARAM_BOOL(cpu_power) \
|
||||
OVERLAY_PARAM_BOOL(gpu_temp) \
|
||||
OVERLAY_PARAM_BOOL(gpu_junction_temp) \
|
||||
OVERLAY_PARAM_BOOL(gpu_mem_temp) \
|
||||
OVERLAY_PARAM_BOOL(cpu_stats) \
|
||||
OVERLAY_PARAM_BOOL(gpu_stats) \
|
||||
OVERLAY_PARAM_BOOL(ram) \
|
||||
|
Loading…
Reference in New Issue
Block a user