Add a config option to print chunk timings in release

This commit is contained in:
baldurk
2024-08-29 11:14:54 +01:00
parent 2cd162144d
commit 62c86f647e
5 changed files with 92 additions and 44 deletions
+2
View File
@@ -51,6 +51,8 @@ extern "C" const rdcstr VulkanLayerJSONBasename = STRINGIZE(RDOC_BASE_NAME);
RDOC_DEBUG_CONFIG(bool, Capture_Debug_SnapshotDiagnosticLog, false,
"Snapshot the diagnostic log at capture time and embed in the capture.");
RDOC_CONFIG(bool, Replay_Debug_PrintChunkTimings, false, "Print stats of chunk processing times");
// this is declared centrally so it can be shared with any backend - the name is a misnomer but kept
// for backwards compatibility reasons.
RDOC_CONFIG(rdcarray<rdcstr>, DXBC_Debug_SearchDirPaths, {},
+23 -11
View File
@@ -25,6 +25,7 @@
#include "d3d11_device.h"
#include "core/core.h"
#include "core/settings.h"
#include "driver/dxgi/dxgi_wrapped.h"
#include "jpeg-compressor/jpge.h"
#include "maths/formatpacking.h"
@@ -38,6 +39,8 @@
#include "d3d11_resources.h"
#include "d3d11_shader_cache.h"
RDOC_EXTERN_CONFIG(bool, Replay_Debug_PrintChunkTimings);
WRAPPED_POOL_INST(WrappedID3D11Device);
WrappedID3D11Device *WrappedID3D11Device::m_pCurrentWrappedDevice = NULL;
@@ -1519,20 +1522,29 @@ RDResult WrappedID3D11Device::ReadLogInitialisation(RDCFile *rdc, bool storeStru
}
}
const bool develMode =
#if ENABLED(RDOC_DEVEL)
for(auto it = chunkInfos.begin(); it != chunkInfos.end(); ++it)
{
double dcount = double(it->second.count);
RDCDEBUG(
"% 5d chunks - Time: %9.3fms total/%9.3fms avg - Size: %8.3fMB total/%7.3fMB avg - %s (%u)",
it->second.count, it->second.total, it->second.total / dcount,
double(it->second.totalsize) / (1024.0 * 1024.0),
double(it->second.totalsize) / (dcount * 1024.0 * 1024.0),
GetChunkName((uint32_t)it->first).c_str(), uint32_t(it->first));
}
true;
#else
false;
#endif
if(Replay_Debug_PrintChunkTimings() || develMode)
{
for(auto it = chunkInfos.begin(); it != chunkInfos.end(); ++it)
{
double dcount = double(it->second.count);
RDCLOG(
"| % 5d chunks - Time: %9.3fms total/%9.3fms avg - Size: %8.3fMB total/%7.3fMB avg - %s "
"(%u)",
it->second.count, it->second.total, it->second.total / dcount,
double(it->second.totalsize) / (1024.0 * 1024.0),
double(it->second.totalsize) / (dcount * 1024.0 * 1024.0),
GetChunkName((uint32_t)it->first).c_str(), uint32_t(it->first));
}
}
GetReplay()->WriteFrameRecord().frameInfo.uncompressedFileSize =
rdc->GetSectionProperties(sectionIdx).uncompressedSize;
GetReplay()->WriteFrameRecord().frameInfo.compressedFileSize =
+22 -11
View File
@@ -43,6 +43,8 @@
#include "d3d12_resources.h"
#include "d3d12_shader_cache.h"
RDOC_EXTERN_CONFIG(bool, Replay_Debug_PrintChunkTimings);
RDOC_DEBUG_CONFIG(bool, D3D12_Debug_SingleSubmitFlushing, false,
"Every command buffer is submitted and fully flushed to the GPU, to narrow down "
"the source of problems.");
@@ -4918,20 +4920,29 @@ RDResult WrappedID3D12Device::ReadLogInitialisation(RDCFile *rdc, bool storeStru
}
}
const bool develMode =
#if ENABLED(RDOC_DEVEL)
for(auto it = chunkInfos.begin(); it != chunkInfos.end(); ++it)
{
double dcount = double(it->second.count);
RDCDEBUG(
"% 5d chunks - Time: %9.3fms total/%9.3fms avg - Size: %8.3fMB total/%7.3fMB avg - %s (%u)",
it->second.count, it->second.total, it->second.total / dcount,
double(it->second.totalsize) / (1024.0 * 1024.0),
double(it->second.totalsize) / (dcount * 1024.0 * 1024.0),
GetChunkName((uint32_t)it->first).c_str(), uint32_t(it->first));
}
true;
#else
false;
#endif
if(Replay_Debug_PrintChunkTimings() || develMode)
{
for(auto it = chunkInfos.begin(); it != chunkInfos.end(); ++it)
{
double dcount = double(it->second.count);
RDCLOG(
"| % 5d chunks - Time: %9.3fms total/%9.3fms avg - Size: %8.3fMB total/%7.3fMB avg - %s "
"(%u)",
it->second.count, it->second.total, it->second.total / dcount,
double(it->second.totalsize) / (1024.0 * 1024.0),
double(it->second.totalsize) / (dcount * 1024.0 * 1024.0),
GetChunkName((uint32_t)it->first).c_str(), uint32_t(it->first));
}
}
GetReplay()->WriteFrameRecord().frameInfo.uncompressedFileSize =
rdc->GetSectionProperties(sectionIdx).uncompressedSize;
GetReplay()->WriteFrameRecord().frameInfo.compressedFileSize =
+23 -11
View File
@@ -26,12 +26,15 @@
#include "gl_driver.h"
#include <algorithm>
#include "common/common.h"
#include "core/settings.h"
#include "driver/shaders/spirv/spirv_compile.h"
#include "jpeg-compressor/jpge.h"
#include "serialise/rdcfile.h"
#include "strings/string_utils.h"
#include "gl_replay.h"
RDOC_EXTERN_CONFIG(bool, Replay_Debug_PrintChunkTimings);
std::map<uint64_t, GLWindowingData> WrappedOpenGL::m_ActiveContexts;
void WrappedOpenGL::BuildGLExtensions()
@@ -3508,20 +3511,29 @@ RDResult WrappedOpenGL::ReadLogInitialisation(RDCFile *rdc, bool storeStructured
m_ImplicitThreadSwitches));
}
const bool develMode =
#if ENABLED(RDOC_DEVEL)
for(auto it = chunkInfos.begin(); it != chunkInfos.end(); ++it)
{
double dcount = double(it->second.count);
RDCDEBUG(
"% 5d chunks - Time: %9.3fms total/%9.3fms avg - Size: %8.3fMB total/%7.3fMB avg - %s (%u)",
it->second.count, it->second.total, it->second.total / dcount,
double(it->second.totalsize) / (1024.0 * 1024.0),
double(it->second.totalsize) / (dcount * 1024.0 * 1024.0),
GetChunkName((uint32_t)it->first).c_str(), uint32_t(it->first));
}
true;
#else
false;
#endif
if(Replay_Debug_PrintChunkTimings() || develMode)
{
for(auto it = chunkInfos.begin(); it != chunkInfos.end(); ++it)
{
double dcount = double(it->second.count);
RDCLOG(
"| % 5d chunks - Time: %9.3fms total/%9.3fms avg - Size: %8.3fMB total/%7.3fMB avg - %s "
"(%u)",
it->second.count, it->second.total, it->second.total / dcount,
double(it->second.totalsize) / (1024.0 * 1024.0),
double(it->second.totalsize) / (dcount * 1024.0 * 1024.0),
GetChunkName((uint32_t)it->first).c_str(), uint32_t(it->first));
}
}
// steal the structured data for ourselves
m_StructuredFile->Swap(*m_StoredStructuredData);
+22 -11
View File
@@ -37,6 +37,8 @@
#include "stb/stb_image_write.h"
RDOC_EXTERN_CONFIG(bool, Replay_Debug_PrintChunkTimings);
RDOC_EXTERN_CONFIG(bool, Vulkan_Debug_VerboseCommandRecording);
RDOC_DEBUG_CONFIG(bool, Vulkan_Debug_SingleSubmitFlushing, false,
@@ -3146,20 +3148,29 @@ RDResult WrappedVulkan::ReadLogInitialisation(RDCFile *rdc, bool storeStructured
SAFE_DELETE(sink);
const bool develMode =
#if ENABLED(RDOC_DEVEL)
for(auto it = chunkInfos.begin(); it != chunkInfos.end(); ++it)
{
double dcount = double(it->second.count);
RDCDEBUG(
"% 5d chunks - Time: %9.3fms total/%9.3fms avg - Size: %8.3fMB total/%7.3fMB avg - %s (%u)",
it->second.count, it->second.total, it->second.total / dcount,
double(it->second.totalsize) / (1024.0 * 1024.0),
double(it->second.totalsize) / (dcount * 1024.0 * 1024.0),
GetChunkName((uint32_t)it->first).c_str(), uint32_t(it->first));
}
true;
#else
false;
#endif
if(Replay_Debug_PrintChunkTimings() || develMode)
{
for(auto it = chunkInfos.begin(); it != chunkInfos.end(); ++it)
{
double dcount = double(it->second.count);
RDCLOG(
"| % 5d chunks - Time: %9.3fms total/%9.3fms avg - Size: %8.3fMB total/%7.3fMB avg - %s "
"(%u)",
it->second.count, it->second.total, it->second.total / dcount,
double(it->second.totalsize) / (1024.0 * 1024.0),
double(it->second.totalsize) / (dcount * 1024.0 * 1024.0),
GetChunkName((uint32_t)it->first).c_str(), uint32_t(it->first));
}
}
// steal the structured data for ourselves
m_StructuredFile->Swap(*m_StoredStructuredData);