1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 19:24:10 +01:00

[dxvk] Hook up platform-specific clock

See 89dfa2bc22
This commit is contained in:
Joshua Ashton 2019-11-26 00:46:24 +00:00 committed by Philip Rebohle
parent 38f945bf0b
commit c39c3e8dcc
7 changed files with 19 additions and 19 deletions

View File

@ -1,4 +1,4 @@
#include <chrono> #include "../util/util_time.h"
#include <cstring> #include <cstring>
#include "dxvk_compute.h" #include "dxvk_compute.h"
@ -117,10 +117,10 @@ namespace dxvk {
info.basePipelineIndex = -1; info.basePipelineIndex = -1;
// Time pipeline compilation for debugging purposes // Time pipeline compilation for debugging purposes
std::chrono::high_resolution_clock::time_point t0, t1; dxvk::high_resolution_clock::time_point t0, t1;
if (Logger::logLevel() <= LogLevel::Debug) if (Logger::logLevel() <= LogLevel::Debug)
t0 = std::chrono::high_resolution_clock::now(); t0 = dxvk::high_resolution_clock::now();
VkPipeline pipeline = VK_NULL_HANDLE; VkPipeline pipeline = VK_NULL_HANDLE;
if (m_vkd->vkCreateComputePipelines(m_vkd->device(), if (m_vkd->vkCreateComputePipelines(m_vkd->device(),
@ -131,7 +131,7 @@ namespace dxvk {
} }
if (Logger::logLevel() <= LogLevel::Debug) { if (Logger::logLevel() <= LogLevel::Debug) {
t1 = std::chrono::high_resolution_clock::now(); t1 = dxvk::high_resolution_clock::now();
auto td = std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0); auto td = std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0);
Logger::debug(str::format("DxvkComputePipeline: Finished in ", td.count(), " ms")); Logger::debug(str::format("DxvkComputePipeline: Finished in ", td.count(), " ms"));
} }

View File

@ -1,4 +1,4 @@
#include <chrono> #include "../util/util_time.h"
#include "dxvk_device.h" #include "dxvk_device.h"
#include "dxvk_graphics.h" #include "dxvk_graphics.h"
@ -396,10 +396,10 @@ namespace dxvk {
info.pTessellationState = nullptr; info.pTessellationState = nullptr;
// Time pipeline compilation for debugging purposes // Time pipeline compilation for debugging purposes
std::chrono::high_resolution_clock::time_point t0, t1; dxvk::high_resolution_clock::time_point t0, t1;
if (Logger::logLevel() <= LogLevel::Debug) if (Logger::logLevel() <= LogLevel::Debug)
t0 = std::chrono::high_resolution_clock::now(); t0 = dxvk::high_resolution_clock::now();
VkPipeline pipeline = VK_NULL_HANDLE; VkPipeline pipeline = VK_NULL_HANDLE;
if (m_vkd->vkCreateGraphicsPipelines(m_vkd->device(), if (m_vkd->vkCreateGraphicsPipelines(m_vkd->device(),
@ -410,7 +410,7 @@ namespace dxvk {
} }
if (Logger::logLevel() <= LogLevel::Debug) { if (Logger::logLevel() <= LogLevel::Debug) {
t1 = std::chrono::high_resolution_clock::now(); t1 = dxvk::high_resolution_clock::now();
auto td = std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0); auto td = std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0);
Logger::debug(str::format("DxvkGraphicsPipeline: Finished in ", td.count(), " ms")); Logger::debug(str::format("DxvkGraphicsPipeline: Finished in ", td.count(), " ms"));
} }

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <atomic> #include <atomic>
#include <chrono> #include "../util/util_time.h"
#include <condition_variable> #include <condition_variable>
#include <fstream> #include <fstream>

View File

@ -145,13 +145,13 @@ namespace dxvk {
while (!m_stopped.load()) { while (!m_stopped.load()) {
if (m_finishQueue.empty()) { if (m_finishQueue.empty()) {
auto t0 = std::chrono::high_resolution_clock::now(); auto t0 = dxvk::high_resolution_clock::now();
m_submitCond.wait(lock, [this] { m_submitCond.wait(lock, [this] {
return m_stopped.load() || !m_finishQueue.empty(); return m_stopped.load() || !m_finishQueue.empty();
}); });
auto t1 = std::chrono::high_resolution_clock::now(); auto t1 = dxvk::high_resolution_clock::now();
m_gpuIdle += std::chrono::duration_cast<std::chrono::microseconds>(t1 - t0).count(); m_gpuIdle += std::chrono::duration_cast<std::chrono::microseconds>(t1 - t0).count();
} }

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <chrono> #include "../util/util_time.h"
#include "dxvk_hud_config.h" #include "dxvk_hud_config.h"
#include "dxvk_hud_renderer.h" #include "dxvk_hud_renderer.h"
@ -13,7 +13,7 @@ namespace dxvk::hud {
* Displays the current frames per second. * Displays the current frames per second.
*/ */
class HudFps { class HudFps {
using Clock = std::chrono::high_resolution_clock; using Clock = dxvk::high_resolution_clock;
using TimeDiff = std::chrono::microseconds; using TimeDiff = std::chrono::microseconds;
using TimePoint = typename Clock::time_point; using TimePoint = typename Clock::time_point;

View File

@ -4,7 +4,7 @@ namespace dxvk::hud {
HudStats::HudStats(HudElements elements) HudStats::HudStats(HudElements elements)
: m_elements(filterElements(elements)), : m_elements(filterElements(elements)),
m_compilerShowTime(std::chrono::high_resolution_clock::now()) { } m_compilerShowTime(dxvk::high_resolution_clock::now()) { }
HudStats::~HudStats() { HudStats::~HudStats() {
@ -58,7 +58,7 @@ namespace dxvk::hud {
void HudStats::updateGpuLoad() { void HudStats::updateGpuLoad() {
auto now = std::chrono::high_resolution_clock::now(); auto now = dxvk::high_resolution_clock::now();
uint64_t ticks = std::chrono::duration_cast<std::chrono::microseconds>(now - m_gpuLoadUpdateTime).count(); uint64_t ticks = std::chrono::duration_cast<std::chrono::microseconds>(now - m_gpuLoadUpdateTime).count();
if (ticks >= 500'000) { if (ticks >= 500'000) {
@ -194,7 +194,7 @@ namespace dxvk::hud {
const Rc<DxvkContext>& context, const Rc<DxvkContext>& context,
HudRenderer& renderer, HudRenderer& renderer,
HudPos position) { HudPos position) {
auto now = std::chrono::high_resolution_clock::now(); auto now = dxvk::high_resolution_clock::now();
bool doShow = m_prevCounters.getCtr(DxvkStatCounter::PipeCompilerBusy); bool doShow = m_prevCounters.getCtr(DxvkStatCounter::PipeCompilerBusy);
if (m_prevCounters.getCtr(DxvkStatCounter::PipeCompilerBusy) if (m_prevCounters.getCtr(DxvkStatCounter::PipeCompilerBusy)

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <chrono> #include "../util/util_time.h"
#include "../dxvk_stats.h" #include "../dxvk_stats.h"
@ -38,8 +38,8 @@ namespace dxvk::hud {
DxvkStatCounters m_prevCounters; DxvkStatCounters m_prevCounters;
DxvkStatCounters m_diffCounters; DxvkStatCounters m_diffCounters;
std::chrono::high_resolution_clock::time_point m_gpuLoadUpdateTime; dxvk::high_resolution_clock::time_point m_gpuLoadUpdateTime;
std::chrono::high_resolution_clock::time_point m_compilerShowTime; dxvk::high_resolution_clock::time_point m_compilerShowTime;
uint64_t m_prevGpuIdleTicks = 0; uint64_t m_prevGpuIdleTicks = 0;
uint64_t m_diffGpuIdleTicks = 0; uint64_t m_diffGpuIdleTicks = 0;