Skip to content

Commit a997fbf

Browse files
committed
param: cpu_efficiency
1 parent f8a36e9 commit a997fbf

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu
357357
| `cpu_power`<br>`gpu_power` | Display CPU/GPU draw in watts |
358358
| `cpu_temp`<br>`gpu_temp`<br>`gpu_junction_temp`<br>`gpu_mem_temp` | Display current CPU/GPU temperature |
359359
| `cpu_text`<br>`gpu_text` | Override CPU and GPU text. `gpu_text` is a list in case of multiple GPUs |
360+
| `cpu_efficiency` | Display CPU efficiency in frames per joule |
360361
| `custom_text_center` | Display a custom text centered useful for a header e.g `custom_text_center=FlightLessMango Benchmarks` |
361362
| `custom_text` | Display a custom text e.g `custom_text=Fsync enabled` |
362363
| `debug` | Shows the graph of gamescope app frametimes and latency (only on gamescope obviously) |
@@ -407,7 +408,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu
407408
| `gpu_voltage` | Display GPU voltage (only works on AMD GPUs) |
408409
| `gpu_list` | List GPUs to display `gpu_list=0,1` |
409410
| `gpu_efficiency` | Display GPU efficiency in frames per joule |
410-
| `flip_efficiency` | Flips GPU efficiency to joules per frame |
411+
| `flip_efficiency` | Flips CPU and GPU efficiency to joules per frame |
411412
| `hide_fsr_sharpness` | Hides the sharpness info for the `fsr` option (only available in gamescope) |
412413
| `histogram` | Change FPS graph to histogram |
413414
| `horizontal` | Display Mangohud in a horizontal position |

data/MangoHud.conf

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ cpu_stats
105105
# cpu_load_change
106106
# cpu_load_value=60,90
107107
# cpu_load_color=39F900,FDFD09,B22222
108+
# cpu_efficiency
108109

109110
### Display the current CPU load & frequency for each core
110111
# core_load

src/hud_elements.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,24 @@ void HudElements::cpu_stats(){
394394
HUDElements.TextColored(HUDElements.colors.text, "W");
395395
ImGui::PopFont();
396396
}
397+
398+
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_cpu_efficiency]) {
399+
ImguiNextColumnOrNewRow();
400+
float efficiency;
401+
const char* efficiency_unit;
402+
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_flip_efficiency]) {
403+
efficiency=cpuStats.GetCPUDataTotal().power/HUDElements.sw_stats->fps;
404+
efficiency_unit="J/F";
405+
} else {
406+
efficiency=HUDElements.sw_stats->fps/cpuStats.GetCPUDataTotal().power;
407+
efficiency_unit="F/J";
408+
}
409+
right_aligned_text(text_color, HUDElements.ralign_width, "%.2f", efficiency);
410+
ImGui::SameLine(0, 1.0f);
411+
ImGui::PushFont(HUDElements.sw_stats->font1);
412+
HUDElements.TextColored(HUDElements.colors.text, efficiency_unit);
413+
ImGui::PopFont();
414+
}
397415
}
398416
}
399417

src/overlay_params.h

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ typedef unsigned long KeySym;
115115
OVERLAY_PARAM_BOOL(present_mode) \
116116
OVERLAY_PARAM_BOOL(time_no_label) \
117117
OVERLAY_PARAM_BOOL(display_server) \
118+
OVERLAY_PARAM_BOOL(cpu_efficiency) \
118119
OVERLAY_PARAM_BOOL(gpu_efficiency) \
119120
OVERLAY_PARAM_BOOL(flip_efficiency) \
120121
OVERLAY_PARAM_CUSTOM(fps_sampling_period) \

0 commit comments

Comments
 (0)