[development] Migrate Atom CPU timing stats tracking to use global stats profiler (#4549)

This change is a preparation for moving the CPU profiler/visualization system from Atom into its own Gem by removing the dependency on local time tracking object AZ::RHI::CpuTimingStatistics

Full changes include:
- Removed all usage of AZ::RHI::CpuTimingStatistics
-- Replaced with pushing to AZ::Statistics::StatisticalProfilerProxy global instance
- Promoted VariableTimer from AZ::RHI to AZ::Debug
- Removed now unused CpuTimingStatistics.h

Signed-off-by: AMZN-ScottR 24445312+AMZN-ScottR@users.noreply.github.com
This commit is contained in:
Scott Romero
2021-10-11 14:00:42 -07:00
committed by GitHub
parent d3c2e288e9
commit a95c609bd8
36 changed files with 213 additions and 221 deletions
@@ -11,7 +11,6 @@
#include <Atom/RHI/CpuProfilerImpl.h>
#include <Atom/RHI/RHIUtils.h>
#include <Atom/RHI/RHISystemInterface.h>
#include <Atom/RHI.Reflect/CpuTimingStatistics.h>
#include <AzCore/Statistics/RunningStatistic.h>
#include <Atom/RPI.Public/GpuQuery/GpuQueryTypes.h>
@@ -457,17 +456,8 @@ namespace AZ
JsonSerializerSettings serializationSettings;
serializationSettings.m_keepDefaults = true;
double frameTime = 0.0;
const AZ::RHI::CpuTimingStatistics* stats = AZ::RHI::RHISystemInterface::Get()->GetCpuTimingStatistics();
if (stats)
{
frameTime = stats->GetFrameToFrameTimeMilliseconds();
}
else
{
AZStd::string warning = AZStd::string::format("Failed to get Cpu frame time");
AZ_Warning("ProfilingCaptureSystemComponent", false, warning.c_str());
}
double frameTime = AZ::RHI::RHISystemInterface::Get()->GetCpuFrameTime();
AZ_Warning("ProfilingCaptureSystemComponent", frameTime > 0, "Failed to get Cpu frame time");
CpuFrameTimeSerializer serializer(frameTime);
const auto saveResult = JsonSerializationUtils::SaveObjectToFile(&serializer,