From eee1c8d4eab52962583d84cb372c68c17c52cf71 Mon Sep 17 00:00:00 2001 From: Rene Thrane Date: Thu, 11 Sep 2025 17:40:00 +0200 Subject: [PATCH] Improved performance capture capabilities, allow us to capture for the same key cumulatively. --- .../System/BasicPerformanceCapture.hpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/DemoFramework/FslBase/include/FslBase/System/BasicPerformanceCapture.hpp b/DemoFramework/FslBase/include/FslBase/System/BasicPerformanceCapture.hpp index 05151efe7a..f37c9dd4b4 100644 --- a/DemoFramework/FslBase/include/FslBase/System/BasicPerformanceCapture.hpp +++ b/DemoFramework/FslBase/include/FslBase/System/BasicPerformanceCapture.hpp @@ -87,6 +87,33 @@ namespace Fsl m_results[static_cast(keyBegin)].Begin = counter; } + inline void CumulativeBegin(const key_type key) + { + const auto keyIndex = static_cast(key); + assert(keyIndex <= m_results.size()); + m_results[keyIndex].Begin = PerformanceCounter::GetPerformanceCounter() - (m_results[keyIndex].End - m_results[keyIndex].Begin); + } + + inline void CumulativeEnd(const key_type key) + { + const auto keyIndex = static_cast(key); + assert(keyIndex <= m_results.size()); + m_results[keyIndex].End = PerformanceCounter::GetPerformanceCounter(); + } + + inline void CumulativeEndThenBegin(const key_type keyEnd, const key_type keyBegin) + { + const auto keyEndIndex = static_cast(keyEnd); + const auto keyBeginIndex = static_cast(keyBegin); + + assert(keyEndIndex <= m_results.size()); + assert(keyBeginIndex <= m_results.size()); + + const auto counter = PerformanceCounter::GetPerformanceCounter(); + m_results[keyEndIndex].End = counter; + m_results[keyBeginIndex].Begin = counter - (m_results[keyBeginIndex].End - m_results[keyBeginIndex].Begin); + } + inline const BasicPerformanceCaptureRecord& Get(const key_type key) const { assert(static_cast(key) <= m_results.size());