Deprecate profiler categories based on global enum

(to be supplanted by registered budgets in the future)

Signed-off-by: Jeremy Ong <jcong@amazon.com>
This commit is contained in:
Jeremy Ong
2021-08-17 12:10:57 -06:00
parent d15d40fec6
commit df9b4d4a2f
274 changed files with 1435 additions and 1965 deletions
@@ -40,7 +40,7 @@ namespace GridMate
, m_priority(0)
, m_revision(1)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
m_upstreamHop = nullptr;
m_dirtyHook.m_next = m_dirtyHook.m_prev = nullptr;
@@ -86,7 +86,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void Replica::PreDestruct()
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
for (auto chunk : m_chunks)
{
@@ -137,7 +137,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
bool Replica::AttachReplicaChunk(const ReplicaChunkPtr& chunk)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
// Check for duplicate attach
if (!chunk->GetReplica())
@@ -174,7 +174,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
bool Replica::DetachReplicaChunk(const ReplicaChunkPtr& chunk)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
if (!IsActive())
{
@@ -213,7 +213,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void Replica::UpdateReplica(const ReplicaContext& rc)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
for (auto chunk : m_chunks)
{
@@ -226,7 +226,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void Replica::UpdateFromReplica(const ReplicaContext& rc)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
for (auto chunk : m_chunks)
{
@@ -239,7 +239,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
bool Replica::AcceptChangeOwnership(PeerId requestor, const ReplicaContext& rc)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
for (auto chunk : m_chunks)
{
@@ -274,7 +274,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void Replica::OnDeactivate(const ReplicaContext& rc)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
EBUS_EVENT_ID(rc.m_rm->GetGridMate(), ReplicaMgrCallbackBus, OnDeactivateReplica, GetRepId(), rc.m_rm);
EBUS_EVENT(Debug::ReplicaDrillerBus, OnDeactivateReplica, this);
@@ -294,7 +294,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void Replica::OnChangeOwnership(const ReplicaContext& rc)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
for (auto chunk : m_chunks)
{
@@ -319,7 +319,7 @@ namespace GridMate
{
(void) rpcContext;
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
if (IsActive())
{
@@ -382,7 +382,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void Replica::Activate(const ReplicaContext& rc)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
// Resolve whether we're migratable or not from the chunks
// present when we're attached to the network.
@@ -410,7 +410,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void Replica::Deactivate(const ReplicaContext& rc)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
if (IsActive())
{
@@ -440,7 +440,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
bool Replica::ProcessRPCs(const ReplicaContext& rc)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
bool isProcessed = true;
for (auto chunk : m_chunks)
@@ -508,7 +508,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
PrepareDataResult Replica::PrepareData(EndianType endianType, AZ::u32 marshalFlags)
{
//AZ_PROFILE_TIMER("GridMate");
//AZ_PROFILE_SCOPE("GridMate");
PrepareDataResult pdr(false, false, false, false);
bool dataSetChange = false;
@@ -536,7 +536,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void Replica::Marshal(MarshalContext& mc)
{
//AZ_PROFILE_TIMER("GridMate");
//AZ_PROFILE_SCOPE("GridMate");
// We are going to replace the outBuffer with a temporary chunk buffer for each chunk,
// hold on to the original so we can restore it later and write the chunk buffers into
@@ -639,7 +639,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
bool Replica::Unmarshal(UnmarshalContext& mc)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
UnmarshalContext chunkContext(mc);
ReadBuffer& buffer = *mc.m_iBuf;
@@ -715,7 +715,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
ReplicaChunkPtr Replica::CreateReplicaChunkFromStream(ReplicaChunkClassId classId, UnmarshalContext& mc)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
ReplicaChunkPtr chunk = nullptr;
ReplicaChunkDescriptor* pDesc = ReplicaChunkDescriptorTable::Get().FindReplicaChunkDescriptor(classId);
@@ -152,7 +152,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
PrepareDataResult ReplicaChunkBase::PrepareData(EndianType endianType, AZ::u32 marshalFlags)
{
//AZ_PROFILE_TIMER("GridMate");
//AZ_PROFILE_SCOPE("GridMate");
PrepareDataResult pdr(false, false, false, false);
bool forceDatasetsReliable = !!(marshalFlags & ReplicaMarshalFlags::ForceReliable);
@@ -250,7 +250,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
bool ReplicaChunkBase::ShouldSendToPeer(ReplicaPeer* peer) const
{
//AZ_PROFILE_TIMER("GridMate");
//AZ_PROFILE_SCOPE("GridMate");
// Only send chunks to the same zone as the peer
return !!(peer->GetZoneMask() & GetDescriptor()->GetZoneMask());
@@ -258,7 +258,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void ReplicaChunkBase::Marshal(MarshalContext& mc, AZ::u32 chunkIndex)
{
//AZ_PROFILE_TIMER("GridMate");
//AZ_PROFILE_SCOPE("GridMate");
SafeGuardWrite(mc.m_outBuffer, [this, &mc, &chunkIndex]()
{
@@ -269,7 +269,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void ReplicaChunkBase::Unmarshal(UnmarshalContext& mc, AZ::u32 chunkIndex)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
SafeGuardRead(mc.m_iBuf, [this, &mc, &chunkIndex]()
{
@@ -334,7 +334,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void ReplicaChunkBase::MarshalDataSets(MarshalContext& mc, AZ::u32 chunkIndex)
{
//AZ_PROFILE_TIMER("GridMate");
//AZ_PROFILE_SCOPE("GridMate");
AZ::u32 dirtyDataSetMask = CalculateDirtyDataSetMask(mc);
AZStd::bitset<GM_MAX_DATASETS_IN_CHUNK> changebits(dirtyDataSetMask);
ReplicaChunkDescriptor* descriptor = GetDescriptor();
@@ -382,7 +382,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void ReplicaChunkBase::UnmarshalDataSets(UnmarshalContext& mc, AZ::u32 chunkIndex)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
AZStd::bitset<GM_MAX_DATASETS_IN_CHUNK> changebits;
if (!mc.m_iBuf->Read(*changebits.data(), VlqU32Marshaler()))
@@ -438,7 +438,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void ReplicaChunkBase::MarshalRpcs(MarshalContext& mc, AZ::u32 chunkIndex)
{
//AZ_PROFILE_TIMER("GridMate");
//AZ_PROFILE_SCOPE("GridMate");
bool isAuthoritative = (mc.m_marshalFlags & ReplicaMarshalFlags::Authoritative) == ReplicaMarshalFlags::Authoritative;
bool isReliable = (mc.m_marshalFlags & ReplicaMarshalFlags::Reliable) == ReplicaMarshalFlags::Reliable;
@@ -496,7 +496,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void ReplicaChunkBase::UnmarshalRpcs(UnmarshalContext& mc, AZ::u32 chunkIndex)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
// Unmarshal RPCs
AZ::u32 rpcCount;
@@ -629,7 +629,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
bool ReplicaChunkBase::ProcessRPCs(const ReplicaContext& rc)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
// Process incoming RPCs
for (RPCQueue::iterator iRPC = m_rpcQueue.begin(); iRPC != m_rpcQueue.end(); )
@@ -733,7 +733,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void ReplicaChunkBase::AttachedToReplica(Replica* replica)
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
AZ_Assert(!m_replica, "Should not be attached to a replica");
@@ -748,7 +748,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void ReplicaChunkBase::DetachedFromReplica()
{
AZ_PROFILE_TIMER("GridMate");
AZ_PROFILE_FUNCTION(GridMate);
AZ_Assert(m_replica, "Should be attached to a replica");
EBUS_EVENT(Debug::ReplicaDrillerBus, OnDetachReplicaChunk, this);
@@ -700,7 +700,7 @@ namespace GridMate
{
if (IsUsingFixedTimeStep())
{
return static_cast<AZ::u32>(m_fixedTimeStep.GetCurrentTime());
return static_cast<AZ::u32>(m_fixedTimeStep.CurrentTime());
}
else
{
@@ -867,7 +867,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void ReplicaManager::UpdateFromReplicas()
{
AZ_PROFILE_TIMER("GridMate", __FUNCTION__);
AZ_PROFILE_FUNCTION(GridMate);
if (!IsInitialized())
{
@@ -888,7 +888,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void ReplicaManager::UpdateReplicas()
{
AZ_PROFILE_TIMER("GridMate", __FUNCTION__);
AZ_PROFILE_FUNCTION(GridMate);
if (!IsInitialized())
{
@@ -940,7 +940,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void ReplicaManager::Marshal()
{
AZ_PROFILE_TIMER("GridMate", __FUNCTION__);
AZ_PROFILE_FUNCTION(GridMate);
if (!IsReady())
{
@@ -1287,7 +1287,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void ReplicaManager::Unmarshal()
{
AZ_PROFILE_TIMER("GridMate", __FUNCTION__);
AZ_PROFILE_FUNCTION(GridMate);
if (!IsInitialized())
{
@@ -302,7 +302,7 @@ namespace GridMate
// this could allow for changing on the fly but it would need to ensure that if it were in the middle of a second, that the new rate would result in landing on the
}
AZ::u64 GetCurrentTime() const
AZ::u64 CurrentTime() const
{
return m_currentTime;
}
@@ -81,7 +81,7 @@ namespace GridMate
#define GM_ENABLE_PROFILE_USER_CALLBACKS 1
#if (GM_ENABLE_PROFILE_USER_CALLBACKS)
#define GM_PROFILE_USER_CALLBACK(callback) AZ_PROFILE_TIMER("GridMate User Code", callback);
#define GM_PROFILE_USER_CALLBACK(callback) AZ_PROFILE_SCOPE(GridMate, "GridMate User Code: %s", callback);
#else
#define GM_PROFILE_USER_CALLBACK(callback)
#endif