diff --git a/src/cpu.cpp b/src/cpu.cpp index 0acdc68e..6799b1b3 100644 --- a/src/cpu.cpp +++ b/src/cpu.cpp @@ -220,6 +220,10 @@ bool CPUStats::UpdateCoreMhz() { i++; } } + m_cpuDataTotal.cpu_mhz = 0; + for (auto data : m_cpuData) + m_cpuDataTotal.cpu_mhz += data.mhz; + m_cpuDataTotal.cpu_mhz /= m_cpuData.size(); return true; } diff --git a/src/cpu.h b/src/cpu.h index 1b2c29d8..29124b22 100644 --- a/src/cpu.h +++ b/src/cpu.h @@ -35,6 +35,7 @@ typedef struct CPUData_ { float percent; int mhz; int temp; + int cpu_mhz; } CPUData; class CPUStats diff --git a/src/hud_elements.cpp b/src/hud_elements.cpp index 1936092b..7e17f523 100644 --- a/src/hud_elements.cpp +++ b/src/hud_elements.cpp @@ -115,6 +115,16 @@ void HudElements::cpu_stats(){ ImGui::SameLine(0, 1.0f); ImGui::Text("°C"); } + if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_cpu_mhz]) + ImGui::TableNextRow(); + if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_cpu_mhz]){ + ImGui::TableNextCell(); + right_aligned_text(HUDElements.sw_stats->colors.text, HUDElements.ralign_width, "%i", cpuStats.GetCPUDataTotal().cpu_mhz); + ImGui::SameLine(0, 1.0f); + ImGui::PushFont(HUDElements.sw_stats->font1); + ImGui::Text("MHz"); + ImGui::PopFont(); + } } } diff --git a/src/overlay_params.h b/src/overlay_params.h index 57eeea15..d3da03d1 100644 --- a/src/overlay_params.h +++ b/src/overlay_params.h @@ -55,6 +55,7 @@ typedef unsigned long KeySym; OVERLAY_PARAM_BOOL(cpu_load_change) \ OVERLAY_PARAM_BOOL(graphs) \ OVERLAY_PARAM_BOOL(legacy_layout) \ + OVERLAY_PARAM_BOOL(cpu_mhz) \ OVERLAY_PARAM_CUSTOM(fps_sampling_period) \ OVERLAY_PARAM_CUSTOM(output_folder) \ OVERLAY_PARAM_CUSTOM(output_file) \