diff --git a/src/hud_elements.cpp b/src/hud_elements.cpp index 4af3a0a5..72afa941 100644 --- a/src/hud_elements.cpp +++ b/src/hud_elements.cpp @@ -463,7 +463,7 @@ void HudElements::frame_timing(){ char hash[40]; snprintf(hash, sizeof(hash), "##%s", overlay_param_names[OVERLAY_PARAM_ENABLED_frame_timing]); HUDElements.sw_stats->stat_selector = OVERLAY_PLOTS_frame_timing; - HUDElements.sw_stats->time_dividor = 1000.0f; + HUDElements.sw_stats->time_dividor = 1000000.0f; /* ns -> ms */ ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.0f, 0.0f, 0.0f, 0.0f)); double min_time = 0.0f; double max_time = 50.0f; diff --git a/src/mesa/util/os_time.h b/src/mesa/util/os_time.h index 049ab118..362b7fcc 100644 --- a/src/mesa/util/os_time.h +++ b/src/mesa/util/os_time.h @@ -52,16 +52,6 @@ int64_t os_time_get_nano(void); -/* - * Get the current time in microseconds from an unknown base. - */ -static inline int64_t -os_time_get(void) -{ - return os_time_get_nano() / 1000; -} - - /* * Sleep. */ diff --git a/src/overlay.cpp b/src/overlay.cpp index c2b5db59..0abf8e9c 100644 --- a/src/overlay.cpp +++ b/src/overlay.cpp @@ -72,9 +72,9 @@ void update_hw_info(struct swapchain_stats& sw_stats, struct overlay_params& par void update_hud_info(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID){ uint32_t f_idx = sw_stats.n_frames % ARRAY_SIZE(sw_stats.frames_stats); - uint64_t now = os_time_get(); /* us */ - double elapsed = (double)(now - sw_stats.last_fps_update); /* us */ - fps = 1000000.0f * sw_stats.n_frames_since_update / elapsed; + uint64_t now = os_time_get_nano(); /* ns */ + double elapsed = (double)(now - sw_stats.last_fps_update); /* ns */ + fps = 1000000000.0 * sw_stats.n_frames_since_update / elapsed; if (logger->is_active()) benchmark.fps_data.push_back(fps); diff --git a/src/overlay_params.cpp b/src/overlay_params.cpp index a59cdd18..1a48e5d2 100644 --- a/src/overlay_params.cpp +++ b/src/overlay_params.cpp @@ -147,7 +147,7 @@ parse_string_to_keysym_vec(const char *str) static uint32_t parse_fps_sampling_period(const char *str) { - return strtol(str, NULL, 0) * 1000; + return strtol(str, NULL, 0) * 1000000; /* ms to ns */ } static std::vector @@ -575,7 +575,7 @@ parse_overlay_config(struct overlay_params *params, params->enabled[OVERLAY_PARAM_ENABLED_core_load_change] = false; params->enabled[OVERLAY_PARAM_ENABLED_legacy_layout] = true; params->enabled[OVERLAY_PARAM_ENABLED_frametime] = true; - params->fps_sampling_period = 500000; /* 500ms */ + params->fps_sampling_period = 500000000; /* 500ms */ params->width = 0; params->height = 140; params->control = -1; diff --git a/src/overlay_params.h b/src/overlay_params.h index a632b513..35bf9ca4 100644 --- a/src/overlay_params.h +++ b/src/overlay_params.h @@ -187,7 +187,7 @@ struct overlay_params { bool enabled[OVERLAY_PARAM_ENABLED_MAX]; enum overlay_param_position position; int control; - uint32_t fps_sampling_period; /* us */ + uint32_t fps_sampling_period; /* ns */ std::vector fps_limit; bool help; bool no_display;