From db68078639a36fd677fd44a7edea85982d2742c5 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 10 Nov 2021 13:25:47 -0800 Subject: [PATCH] Removes TimeDataStatisticsManager from AzCore Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Statistics/TimeDataStatisticsManager.cpp | 49 ------------------ .../Statistics/TimeDataStatisticsManager.h | 51 ------------------- 2 files changed, 100 deletions(-) delete mode 100644 Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.cpp delete mode 100644 Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h diff --git a/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.cpp b/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.cpp deleted file mode 100644 index 0e9b36a8b6..0000000000 --- a/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "TimeDataStatisticsManager.h" - -namespace AZ -{ - namespace Statistics - { - void TimeDataStatisticsManager::PushTimeDataSample(const char * registerName, const AZ::Debug::ProfilerRegister::TimeData& timeData) - { - const AZStd::string statName(registerName); - NamedRunningStatistic* statistic = GetStatistic(statName); - if (!statistic) - { - const AZStd::string units("us"); - AddStatistic(statName, statName, units, false); - AZ::Debug::ProfilerRegister::TimeData zeroTimeData; - memset(&zeroTimeData, 0, sizeof(AZ::Debug::ProfilerRegister::TimeData)); - m_previousTimeData[statName] = zeroTimeData; - statistic = GetStatistic(statName); - AZ_Assert(statistic != nullptr, "Fatal error adding a new statistic object"); - } - - const AZ::u64 accumulatedTime = timeData.m_time; - const AZ::s64 totalNumCalls = timeData.m_calls; - const AZ::u64 previousAccumulatedTime = m_previousTimeData[statName].m_time; - const AZ::s64 previousTotalNumCalls = m_previousTimeData[statName].m_calls; - const AZ::u64 deltaTime = accumulatedTime - previousAccumulatedTime; - const AZ::s64 deltaCalls = totalNumCalls - previousTotalNumCalls; - - if (deltaCalls == 0) - { - //This is the same old data. Let's skip it - return; - } - - double newSample = static_cast(deltaTime) / deltaCalls; - - statistic->PushSample(newSample); - m_previousTimeData[statName] = timeData; - } - } //namespace Statistics -} //namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h b/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h deleted file mode 100644 index c9adc4de2f..0000000000 --- a/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#include -#include - -namespace AZ -{ - namespace Statistics - { - /** - * @brief Specialization useful for data generated with AZ::Debug::FrameProfileComponent - * - * Timer based data collection using AZ_PROFILE_TIMER(...), available in - * AzCore/Debug/Profiler.h can be collected when using AZ::Debug::FrameProfilerComponent - * and AZ::Debug::FrameProfilerBus. The method PushTimeDataSample(...) is a convenience - * to convert those Timer registers into a RunningStatistic. - * - * - */ - class TimeDataStatisticsManager : public StatisticsManager<> - { - public: - TimeDataStatisticsManager() = default; - virtual ~TimeDataStatisticsManager() = default; - - /** - * @brief Adds one sample data to a specific running stat by name. - * - * This method is specialized to work with ProfilerRegister::TimeData that can be intercepted - * during AZ::Debug::FrameProfilerBus::OnFrameProfilerData(). - * For each @param registerName a new RunningStat object is created if it doesn't exist. - * - * Adds the TimeData as one sample for its RunningStatistic. - */ - void PushTimeDataSample(const char * registerName, const AZ::Debug::ProfilerRegister::TimeData& timeData); - - protected: - ///We store here the previous value from the previous timer frame data. - ///This is necessary because AZ_PROFILER_TIMER is cumulative - ///and we need the time spent for each call. - AZStd::unordered_map m_previousTimeData; - }; - } //namespace Statistics -} //namespace AZ