|
@@ -209,6 +209,25 @@ namespace Multiplayer
|
|
|
AZLOG_WARN("Stat with id %d has not been declared using DECLARE_PERFORMANCE_STAT", uniqueStatId);
|
|
|
}
|
|
|
|
|
|
+ void MultiplayerStatSystemComponent::IncrementStat(int uniqueStatId)
|
|
|
+ {
|
|
|
+ AZStd::lock_guard lock(m_access);
|
|
|
+ const auto statIterator = m_statIdToGroupId.find(uniqueStatId);
|
|
|
+ if (statIterator != m_statIdToGroupId.end())
|
|
|
+ {
|
|
|
+ if (const auto group = m_statGroups.Find(statIterator->second))
|
|
|
+ {
|
|
|
+ if (CumulativeAverage* stat = group->m_stats.Find(uniqueStatId))
|
|
|
+ {
|
|
|
+ stat->m_counterValue++;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ AZLOG_WARN("Stat with id %d has not been declared using DECLARE_PERFORMANCE_STAT", uniqueStatId);
|
|
|
+ }
|
|
|
+
|
|
|
void MultiplayerStatSystemComponent::RecordMetrics()
|
|
|
{
|
|
|
if (const auto* eventLoggerFactory = AZ::Interface<AZ::Metrics::IEventLoggerFactory>::Get())
|
|
@@ -227,6 +246,13 @@ namespace Multiplayer
|
|
|
// If there are new entries, update the average.
|
|
|
argsContainer.emplace_back(stat.m_name.c_str(), stat.m_average.CalculateAverage());
|
|
|
}
|
|
|
+ else if (stat.m_counterValue > 0)
|
|
|
+ {
|
|
|
+ // counter metric
|
|
|
+ argsContainer.emplace_back(stat.m_name.c_str(), stat.m_counterValue);
|
|
|
+ stat.m_counterValue = 0;
|
|
|
+ stat.m_lastValue = 0;
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
// If there were no entries within the last collection period, report the last value received.
|