A little more "atomic" cpu temp update for hud renderer; whitespace

pull/286/head^2
jackun 4 years ago
parent 759c4aeed1
commit c75232389b
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -227,13 +227,13 @@ bool CPUStats::UpdateCpuTemp() {
if (!m_cpuTempFile)
return false;
int temp = 0;
rewind(m_cpuTempFile);
fflush(m_cpuTempFile);
if (fscanf(m_cpuTempFile, "%d", &m_cpuDataTotal.temp) != 1)
return false;
m_cpuDataTotal.temp /= 1000;
bool ret = (fscanf(m_cpuTempFile, "%d", &temp) == 1);
m_cpuDataTotal.temp = temp / 1000;
return true;
return ret;
}
static bool find_temp_input(const std::string path, std::string& input, const std::string& name)

@ -708,42 +708,42 @@ void init_system_info(){
parse_pciids();
}
void update_hw_info(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID){
if (params.enabled[OVERLAY_PARAM_ENABLED_cpu_stats] || logger->is_active()) {
cpuStats.UpdateCPUData();
sw_stats.total_cpu = cpuStats.GetCPUDataTotal().percent;
if (params.enabled[OVERLAY_PARAM_ENABLED_core_load])
cpuStats.UpdateCoreMhz();
if (params.enabled[OVERLAY_PARAM_ENABLED_cpu_temp] || logger->is_active())
cpuStats.UpdateCpuTemp();
}
void update_hw_info(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID)
{
if (params.enabled[OVERLAY_PARAM_ENABLED_cpu_stats] || logger->is_active()) {
cpuStats.UpdateCPUData();
if (params.enabled[OVERLAY_PARAM_ENABLED_core_load])
cpuStats.UpdateCoreMhz();
if (params.enabled[OVERLAY_PARAM_ENABLED_cpu_temp] || logger->is_active())
cpuStats.UpdateCpuTemp();
}
if (params.enabled[OVERLAY_PARAM_ENABLED_gpu_stats] || logger->is_active()) {
if (vendorID == 0x1002)
getAmdGpuInfo();
if (params.enabled[OVERLAY_PARAM_ENABLED_gpu_stats] || logger->is_active()) {
if (vendorID == 0x1002)
getAmdGpuInfo();
if (vendorID == 0x10de)
getNvidiaGpuInfo();
}
if (vendorID == 0x10de)
getNvidiaGpuInfo();
}
// get ram usage/max
if (params.enabled[OVERLAY_PARAM_ENABLED_ram] || logger->is_active())
update_meminfo();
if (params.enabled[OVERLAY_PARAM_ENABLED_io_read] || params.enabled[OVERLAY_PARAM_ENABLED_io_write])
getIoStats(&sw_stats.io);
// get ram usage/max
if (params.enabled[OVERLAY_PARAM_ENABLED_ram] || logger->is_active())
update_meminfo();
if (params.enabled[OVERLAY_PARAM_ENABLED_io_read] || params.enabled[OVERLAY_PARAM_ENABLED_io_write])
getIoStats(&sw_stats.io);
currentLogData.gpu_load = gpu_info.load;
currentLogData.gpu_temp = gpu_info.temp;
currentLogData.gpu_core_clock = gpu_info.CoreClock;
currentLogData.gpu_mem_clock = gpu_info.MemClock;
currentLogData.gpu_vram_used = gpu_info.memoryUsed;
currentLogData.ram_used = memused;
currentLogData.gpu_load = gpu_info.load;
currentLogData.gpu_temp = gpu_info.temp;
currentLogData.gpu_core_clock = gpu_info.CoreClock;
currentLogData.gpu_mem_clock = gpu_info.MemClock;
currentLogData.gpu_vram_used = gpu_info.memoryUsed;
currentLogData.ram_used = memused;
currentLogData.cpu_load = cpuStats.GetCPUDataTotal().percent;
currentLogData.cpu_temp = cpuStats.GetCPUDataTotal().temp;
currentLogData.cpu_load = cpuStats.GetCPUDataTotal().percent;
currentLogData.cpu_temp = cpuStats.GetCPUDataTotal().temp;
logger->notify_data_valid();
logger->notify_data_valid();
}
void check_keybinds(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID){
@ -1159,7 +1159,7 @@ void render_mango(swapchain_stats& data, struct overlay_params& params, ImVec2&
cpu_text = params.cpu_text.c_str();
ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(params.cpu_color), "%s", cpu_text);
ImGui::TableNextCell();
right_aligned_text(ralign_width, "%d", data.total_cpu);
right_aligned_text(ralign_width, "%d", cpuStats.GetCPUDataTotal().percent);
ImGui::SameLine(0, 1.0f);
ImGui::Text("%%");
}
@ -1272,7 +1272,7 @@ void render_imgui(swapchain_stats& data, struct overlay_params& params, ImVec2&
cpu_text = params.cpu_text.c_str();
ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(params.cpu_color), "%s", cpu_text);
ImGui::TableNextCell();
right_aligned_text(ralign_width, "%d", data.total_cpu);
right_aligned_text(ralign_width, "%d", cpuStats.GetCPUDataTotal().percent);
ImGui::SameLine(0, 1.0f);
ImGui::Text("%%");
// ImGui::SameLine(150);

@ -26,7 +26,6 @@ struct swapchain_stats {
std::string time;
double fps;
struct iostats io;
int total_cpu;
uint64_t last_present_time;
unsigned n_frames_since_update;
uint64_t last_fps_update;

Loading…
Cancel
Save