[atom_cpu_profiler_gem_promotion] quick small changes based on PR feedback

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
This commit is contained in:
AMZN-ScottR
2021-10-18 17:54:08 -07:00
parent fa4e91b05c
commit 55bca4658f
7 changed files with 15 additions and 18 deletions
@@ -86,6 +86,8 @@ namespace AZ
if (auto statsProfiler = AZ::Interface<AZ::Statistics::StatisticalProfilerProxy>::Get(); statsProfiler)
{
statsProfiler->ActivateProfiler(rhiMetricsId, true);
auto& rhiMetrics = statsProfiler->GetProfiler(rhiMetricsId);
rhiMetrics.GetStatsManager().AddStatistic(frameTimeMetricId, frameTimeMetricName, /*units=*/"clocks", /*failIfExist=*/false);
}
+1 -1
View File
@@ -38,7 +38,7 @@ namespace Profiler
};
CachedTimeRegion() = default;
CachedTimeRegion(const GroupRegionName& groupRegionName);
explicit CachedTimeRegion(const GroupRegionName& groupRegionName);
CachedTimeRegion(const GroupRegionName& groupRegionName, uint16_t stackDepth, uint64_t startTick, uint64_t endTick);
GroupRegionName m_groupRegionName{nullptr, nullptr};
@@ -71,11 +71,6 @@ namespace Profiler
m_initialized = true;
AZ::SystemTickBus::Handler::BusConnect();
m_continuousCaptureData.set_capacity(10);
if (auto statsProfiler = AZ::Interface<AZ::Statistics::StatisticalProfilerProxy>::Get(); statsProfiler)
{
statsProfiler->ActivateProfiler(AZ_CRC_CE("RHI"), true);
}
}
void CpuProfilerImpl::Shutdown()
@@ -290,7 +285,7 @@ namespace Profiler
m_cachedTimeRegions.clear();
}
timeRegion.m_stackDepth = static_cast<uint16_t>(m_stackLevel);
timeRegion.m_stackDepth = aznumeric_cast<uint16_t>(m_stackLevel);
AZ_Assert(m_timeRegionStack.size() < TimeRegionStackSize, "Adding too many time regions to the stack. Increase the size of TimeRegionStackSize.");
m_timeRegionStack.push_back(timeRegion);
@@ -45,12 +45,12 @@ namespace Profiler
using DeserializedCpuData = AZStd::vector<CpuProfilingStatisticsSerializer::CpuProfilingStatisticsSerializerEntry>;
AZ::Outcome<DeserializedCpuData, AZStd::string> LoadSavedCpuProfilingStatistics(const AZStd::string& capturePath)
AZ::Outcome<DeserializedCpuData, AZStd::string> LoadSavedCpuProfilingStatistics(const char* capturePath)
{
auto* base = AZ::IO::FileIOBase::GetInstance();
char resolvedPath[AZ::IO::MaxPathLength];
if (!base->ResolvePath(capturePath.c_str(), resolvedPath, AZ::IO::MaxPathLength))
if (!base->ResolvePath(capturePath, resolvedPath, AZ::IO::MaxPathLength))
{
return AZ::Failure(AZStd::string::format("Could not resolve the path to file %s, is the path correct?", resolvedPath));
}
@@ -103,7 +103,7 @@ namespace Profiler
if (deserializationResult.GetProcessing() == AZ::JsonSerializationResult::Processing::Halted
|| serializer.m_cpuProfilingStatisticsSerializerEntries.empty())
{
return AZ::Failure(AZStd::string::format("Error in deserializing document: %s\n", deserializationResult.ToString(capturePath.c_str()).c_str()));
return AZ::Failure(AZStd::string::format("Error in deserializing document: %s\n", deserializationResult.ToString(capturePath).c_str()));
}
AZ_TracePrintf("JsonUtils", "Successfully loaded CPU profiling data with %zu profiling entries.\n",
@@ -421,7 +421,7 @@ namespace Profiler
void ImGuiCpuProfiler::LoadFile()
{
const AZ::IO::Path& pathToLoad = m_cachedCapturePaths[m_currentFileIndex];
auto loadResult = CpuProfilerImGuiHelper::LoadSavedCpuProfilingStatistics(pathToLoad.String());
auto loadResult = CpuProfilerImGuiHelper::LoadSavedCpuProfilingStatistics(pathToLoad.c_str());
if (!loadResult.IsSuccess())
{
AZ_TracePrintf("ImGuiCpuProfiler", "%s", loadResult.GetError().c_str());
+5 -5
View File
@@ -71,9 +71,9 @@ namespace Profiler
AZStd::sys_time_t m_runningAverageTicks = 0;
};
//! ImGui widget for examining Atom CPU Profiling instrumentation.
//! ImGui widget for examining CPU Profiling instrumentation.
//! Offers both a statistical view (with sorting and searching capability) and a visualizer
//! similar to RAD and other profiling tools.
//! similar to other profiling tools.
class ImGuiCpuProfiler
: public AZ::SystemTickBus::Handler
{
@@ -99,10 +99,10 @@ namespace Profiler
void Draw(bool& keepDrawing);
private:
static constexpr float RowHeight = 35.0;
static constexpr float RowHeight = 35.0f;
static constexpr int DefaultFramesToCollect = 50;
static constexpr float MediumFrameTimeLimit = 16.6; // 60 fps
static constexpr float HighFrameTimeLimit = 33.3; // 30 fps
static constexpr float MediumFrameTimeLimit = 16.6f; // 60 fps
static constexpr float HighFrameTimeLimit = 33.3f; // 30 fps
//! Draws the statistical view of the CPU profiling data.
void DrawStatisticsView();
@@ -29,7 +29,7 @@ namespace Profiler
{
ec->Class<ProfilerImGuiSystemComponent>("ProfilerImGui", "Provides in-game visualization of the performance data gathered by the ProfilerSystemComponent")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("System"))
->Attribute(AZ::Edit::Attributes::AutoExpand, true);
}
}
@@ -126,7 +126,7 @@ namespace Profiler
{
ec->Class<ProfilerSystemComponent>("Profiler", "Provides a custom implementation of the AZ::Debug::Profiler interface for capturing performance data")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("System"))
->Attribute(AZ::Edit::Attributes::AutoExpand, true);
ProfilerNotificationBusHandler::Reflect(context);