1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[dxvk] Log start/stop of pipe compiler worker threads

This commit is contained in:
Philip Rebohle 2018-05-13 15:37:31 +02:00
parent 368eea7310
commit 2ee80ce1bd
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 11 additions and 5 deletions

View File

@ -9,14 +9,14 @@ namespace dxvk {
1u, std::thread::hardware_concurrency() / 2); 1u, std::thread::hardware_concurrency() / 2);
Logger::debug(str::format( Logger::debug(str::format(
"DxvkPipelineCompiler: Using ", threadCount, " threads")); "DxvkPipelineCompiler: Using ", threadCount, " workers"));
// Start the compiler threads // Start the compiler threads
m_compilerThreads.resize(threadCount); m_compilerThreads.resize(threadCount);
for (uint32_t i = 0; i < threadCount; i++) { for (uint32_t i = 0; i < threadCount; i++) {
m_compilerThreads.at(i) = std::thread( m_compilerThreads.at(i) = std::thread(
[this] { this->runCompilerThread(); }); [this, i] { this->runCompilerThread(i); });
} }
} }
@ -24,9 +24,9 @@ namespace dxvk {
DxvkPipelineCompiler::~DxvkPipelineCompiler() { DxvkPipelineCompiler::~DxvkPipelineCompiler() {
{ std::unique_lock<std::mutex> lock(m_compilerLock); { std::unique_lock<std::mutex> lock(m_compilerLock);
m_compilerStop.store(true); m_compilerStop.store(true);
m_compilerCond.notify_all();
} }
m_compilerCond.notify_all();
for (auto& thread : m_compilerThreads) for (auto& thread : m_compilerThreads)
thread.join(); thread.join();
} }
@ -41,7 +41,10 @@ namespace dxvk {
} }
void DxvkPipelineCompiler::runCompilerThread() { void DxvkPipelineCompiler::runCompilerThread(uint32_t workerId) {
Logger::debug(str::format(
"DxvkPipelineCompiler: Worker #", workerId, " started"));
while (!m_compilerStop.load()) { while (!m_compilerStop.load()) {
PipelineEntry entry; PipelineEntry entry;
@ -61,6 +64,9 @@ namespace dxvk {
if (entry.pipeline != nullptr && entry.instance != nullptr) if (entry.pipeline != nullptr && entry.instance != nullptr)
entry.pipeline->compileInstance(entry.instance); entry.pipeline->compileInstance(entry.instance);
} }
Logger::debug(str::format(
"DxvkPipelineCompiler: Worker #", workerId, " stopped"));
} }
} }

View File

@ -51,7 +51,7 @@ namespace dxvk {
std::queue<PipelineEntry> m_compilerQueue; std::queue<PipelineEntry> m_compilerQueue;
std::vector<std::thread> m_compilerThreads; std::vector<std::thread> m_compilerThreads;
void runCompilerThread(); void runCompilerThread(uint32_t workerId);
}; };