Profiling: Add more instrumentation

Adds new instrumentation macros throughout the codebase, using the
visualizer to find where current instrumentation is lacking using the
shadowed sponza sample + editor. Some notes from exploring:

- We spend ~5ms in CullingScene: BeginCulling
- PipelineStateCache: Compact usually 1ms
- CompileImageBarriers takes most of the time in CompileResourceBarriers

Signed-off-by: Jacob Hilliard <jhlliar@amazon.com>
monroegm-disable-blank-issue-2
Jacob Hilliard 4 years ago
parent db8f78890f
commit 4d618ea619

@ -126,6 +126,7 @@ namespace AZ
ResultCode FrameGraph::End()
{
AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameGraph: End");
ResultCode resultCode = ValidateEnd();
if (resultCode != ResultCode::Success)
{

@ -72,6 +72,7 @@ namespace AZ
void FrameGraphExecuter::Begin(const FrameGraph& frameGraph)
{
AZ_TRACE_METHOD();
AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameGraphExecuter: Begin");
BeginInternal(frameGraph);
}

@ -6,6 +6,7 @@
*
*/
#include <Atom/RHI/CpuProfiler.h>
#include <Atom/RHI/PipelineStateCache.h>
#include <Atom/RHI/Factory.h>
#include <AzCore/std/sort.h>
@ -205,6 +206,7 @@ namespace AZ
void PipelineStateCache::Compact()
{
AZ_ATOM_PROFILE_FUNCTION("RHI", "PipelineStateCache: Compact");
AZStd::unique_lock<AZStd::shared_mutex> lock(m_mutex);
// Merge the pending cache into the read-only cache.

@ -469,6 +469,8 @@ namespace AZ
ResourceTransitionLoggerNull logger(imageFrameAttachment.GetId());
#endif
AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameGraphCompiler: CompileImageBarriers (DX12)");
Image& image = static_cast<Image&>(*imageFrameAttachment.GetImage());
RHI::ImageScopeAttachment* scopeAttachment = imageFrameAttachment.GetFirstScopeAttachment();

@ -720,6 +720,7 @@ namespace AZ
void CullingScene::BeginCulling(const AZStd::vector<ViewPtr>& views)
{
AZ_ATOM_PROFILE_FUNCTION("RPI", "CullingScene: BeginCulling");
m_cullDataConcurrencyCheck.soft_lock();
m_debugCtx.ResetCullStats();

@ -298,6 +298,7 @@ namespace AZ
void PassSystem::ProcessQueuedChanges()
{
AZ_ATOM_PROFILE_FUNCTION("RPI", "PassSystem: ProcessQueuedChanges");
RemovePasses();
BuildPasses();
InitializePasses();
@ -313,8 +314,12 @@ namespace AZ
m_state = PassSystemState::Rendering;
Pass::FramePrepareParams params{ &frameGraphBuilder };
{
AZ_ATOM_PROFILE_TIME_GROUP_REGION("RPI", "Pass: FrameBegin");
m_rootPass->FrameBegin(params);
}
}
void PassSystem::FrameEnd()
{

@ -408,6 +408,7 @@ namespace AZ
{
AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "m_srgCallback");
AZ_ATOM_PROFILE_TIME_GROUP_REGION("RPI", "ShaderResourceGroupCallback: SrgCallback");
// Set values for scene srg
if (m_srg && m_srgCallback)
{
@ -418,7 +419,7 @@ namespace AZ
// Get active pipelines which need to be rendered and notify them frame started
AZStd::vector<RenderPipelinePtr> activePipelines;
{
AZ_ATOM_PROFILE_TIME_GROUP_REGION("RPI", "OnStartFrame");
AZ_ATOM_PROFILE_TIME_GROUP_REGION("RPI", "Scene: OnStartFrame");
for (auto& pipeline : m_pipelines)
{
if (pipeline->NeedsRender())
@ -483,6 +484,7 @@ namespace AZ
{
AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "CollectDrawPackets");
AZ_ATOM_PROFILE_TIME_GROUP_REGION("RPI", "CollectDrawPackets");
AZ::JobCompletion* collectDrawPacketsCompletion = aznew AZ::JobCompletion();
// Launch FeatureProcessor::Render() jobs

Loading…
Cancel
Save