[development] updated Profiler interface to allow the forwarding of format string arguments (#7173)

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
This commit is contained in:
Scott Romero
2022-01-27 14:43:52 -08:00
committed by GitHub
parent b695bfa832
commit 8ecaaf36c0
4 changed files with 9 additions and 11 deletions
@@ -67,8 +67,7 @@ namespace AZ::Debug
Profiler() = default;
virtual ~Profiler() = default;
// support for the extra macro args (e.g. format strings) will come in a later PR
virtual void BeginRegion(const Budget* budget, const char* eventName) = 0;
virtual void BeginRegion(const Budget* budget, const char* eventName, size_t eventNameArgCount, ...) = 0;
virtual void EndRegion(const Budget* budget) = 0;
};
@@ -76,12 +75,11 @@ namespace AZ::Debug
{
public:
template<typename... T>
static void BeginRegion([[maybe_unused]] Budget* budget, [[maybe_unused]] const char* eventName, [[maybe_unused]] T const&... args);
static void EndRegion([[maybe_unused]] Budget* budget);
static void BeginRegion(Budget* budget, const char* eventName, T const&... args);
static void EndRegion(Budget* budget);
template<typename... T>
ProfileScope(Budget* budget, char const* eventName, T const&... args);
ProfileScope(Budget* budget, const char* eventName, T const&... args);
~ProfileScope();
@@ -31,10 +31,10 @@ namespace AZ::Debug
if (auto profiler = AZ::Interface<Profiler>::Get(); profiler)
{
profiler->BeginRegion(budget, eventName);
profiler->BeginRegion(budget, eventName, sizeof...(T), args...);
}
}
#endif // #if !defined(_RELEASE)
#endif // !defined(_RELEASE)
}
inline void ProfileScope::EndRegion([[maybe_unused]] Budget* budget)
@@ -55,7 +55,7 @@ namespace AZ::Debug
}
template<typename... T>
ProfileScope::ProfileScope(Budget* budget, char const* eventName, T const&... args)
ProfileScope::ProfileScope(Budget* budget, const char* eventName, T const&... args)
: m_budget{ budget }
{
BeginRegion(budget, eventName, args...);