Don't update metrics if we're not logging and not displaying

pull/922/head
FlightlessMango 1 year ago
parent 475026a183
commit 3190778086

@ -5,6 +5,8 @@
#include "gpu.h"
#include "cpu.h"
#include "overlay.h"
#include "hud_elements.h"
#include "logging.h"
std::string metrics_path = "";
struct amdgpu_common_metrics amdgpu_common_metrics;
@ -154,7 +156,10 @@ void amdgpu_metrics_polling_thread() {
memset(metrics_buffer, 0, sizeof(metrics_buffer));
while (1) {
amdgpu_get_samples_and_copy(metrics_buffer, gpu_load_needs_dividing);
if (HUDElements.params->no_display && !logger->is_active())
usleep(100000);
else
amdgpu_get_samples_and_copy(metrics_buffer, gpu_load_needs_dividing);
}
}

@ -5,6 +5,7 @@
#include <inttypes.h>
#include <unistd.h>
#include <string>
#include "overlay_params.h"
// #include <vector>
#define METRICS_UPDATE_PERIOD_MS 500

@ -145,7 +145,9 @@ static void msg_read_thread(){
size_t msg_size = msgrcv(msgid, (void *) raw_msg, sizeof(raw_msg), 1, 0) + sizeof(long);
if (hdr->version == 1){
if (msg_size > offsetof(struct mangoapp_msg_v1, visible_frametime_ns)){
update_hud_info_with_frametime(sw_stats, params, vendorID, mangoapp_v1->visible_frametime_ns);
if (!params.no_display || logger->is_active())
update_hud_info_with_frametime(sw_stats, params, vendorID, mangoapp_v1->visible_frametime_ns);
if (msg_size > offsetof(mangoapp_msg_v1, fsrUpscale)){
g_fsrUpscale = mangoapp_v1->fsrUpscale;
if (params.fsr_steam_sharpness < 0)

@ -286,7 +286,8 @@ void update_hud_info_with_frametime(struct swapchain_stats& sw_stats, const stru
void update_hud_info(struct swapchain_stats& sw_stats, const struct overlay_params& params, uint32_t vendorID){
uint64_t now = os_time_get_nano(); /* ns */
uint64_t frametime_ns = now - sw_stats.last_present_time;
update_hud_info_with_frametime(sw_stats, params, vendorID, frametime_ns);
if (!params.no_display || logger->is_active())
update_hud_info_with_frametime(sw_stats, params, vendorID, frametime_ns);
}
float get_time_stat(void *_data, int _idx)

Loading…
Cancel
Save