Merge pull request #3272 from aws-lumberyard-dev/PIX
Profiler spring cleaning
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <AzCore/Math/Crc.h>
|
||||
#include <AzCore/Component/ComponentApplication.h>
|
||||
#include <AzCore/Component/NonUniformScaleBus.h>
|
||||
#include <AzCore/Debug/Profiler.h>
|
||||
#include <AzCore/Memory/MemoryComponent.h>
|
||||
#include <AzCore/Slice/SliceSystemComponent.h>
|
||||
#include <AzCore/Jobs/JobManagerComponent.h>
|
||||
@@ -540,7 +541,7 @@ namespace AzFramework
|
||||
const AZStd::function<void()>& workForNewThread,
|
||||
const char* newThreadName)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
|
||||
AZStd::thread_desc newThreadDesc;
|
||||
newThreadDesc.m_cpuId = AFFINITY_MASK_USERTHREADS;
|
||||
@@ -548,7 +549,7 @@ namespace AzFramework
|
||||
AZStd::binary_semaphore binarySemaphore;
|
||||
AZStd::thread newThread([&workForNewThread, &binarySemaphore, &newThreadName]
|
||||
{
|
||||
AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzFramework,
|
||||
AZ_PROFILE_SCOPE(AzFramework,
|
||||
"Application::PumpSystemEventLoopWhileDoingWorkInNewThread:ThreadWorker %s", newThreadName);
|
||||
|
||||
workForNewThread();
|
||||
@@ -559,7 +560,7 @@ namespace AzFramework
|
||||
PumpSystemEventLoopUntilEmpty();
|
||||
}
|
||||
{
|
||||
AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzFramework,
|
||||
AZ_PROFILE_SCOPE(AzFramework,
|
||||
"Application::PumpSystemEventLoopWhileDoingWorkInNewThread:WaitOnThread %s", newThreadName);
|
||||
newThread.join();
|
||||
}
|
||||
@@ -571,10 +572,14 @@ namespace AzFramework
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void Application::RunMainLoop()
|
||||
{
|
||||
uint32_t frameCounter = 0;
|
||||
while (!m_exitMainLoopRequested)
|
||||
{
|
||||
PumpSystemEventLoopUntilEmpty();
|
||||
|
||||
AZ_PROFILE_SCOPE(AzCore, "Frame %i", frameCounter);
|
||||
Tick();
|
||||
++frameCounter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
#include <AzCore/Debug/Profiler.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
@@ -206,7 +207,7 @@ namespace AZ::IO::ArchiveInternal
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
size_t ArchiveInternal::CZipPseudoFile::FRead(void* pDest, size_t nSize, size_t nCount, [[maybe_unused]] AZ::IO::HandleType fileHandle)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore);
|
||||
AZ_PROFILE_FUNCTION(AzCore);
|
||||
|
||||
if (!GetFile())
|
||||
{
|
||||
@@ -271,7 +272,7 @@ namespace AZ::IO::ArchiveInternal
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void* ArchiveInternal::CZipPseudoFile::GetFileData(size_t& nFileSize, [[maybe_unused]] AZ::IO::HandleType fileHandle)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore);
|
||||
AZ_PROFILE_FUNCTION(AzCore);
|
||||
|
||||
if (!GetFile())
|
||||
{
|
||||
@@ -685,7 +686,7 @@ namespace AZ::IO
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
AZ::IO::HandleType Archive::FOpen(AZStd::string_view pName, const char* szMode, uint32_t nInputFlags)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore);
|
||||
AZ_PROFILE_FUNCTION(AzCore);
|
||||
|
||||
const size_t pathLen = pName.size();
|
||||
if (pathLen == 0 || pathLen >= MaxPath)
|
||||
@@ -693,7 +694,7 @@ namespace AZ::IO
|
||||
return AZ::IO::InvalidHandle;
|
||||
}
|
||||
|
||||
AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Game, "File: %.*s Archive: %p",
|
||||
AZ_PROFILE_SCOPE(Game, "File: %.*s Archive: %p",
|
||||
aznumeric_cast<int>(pName.size()), pName.data(), this);
|
||||
|
||||
SAutoCollectFileAccessTime accessTime(this);
|
||||
@@ -716,7 +717,7 @@ namespace AZ::IO
|
||||
}
|
||||
|
||||
const bool fileWritable = (nOSFlags & (AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeAppend | AZ::IO::OpenMode::ModeUpdate)) != AZ::IO::OpenMode::Invalid;
|
||||
AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Game, "File: %s Archive: %p", szFullPath->c_str(), this);
|
||||
AZ_PROFILE_SCOPE(Game, "File: %s Archive: %p", szFullPath->c_str(), this);
|
||||
if (fileWritable)
|
||||
{
|
||||
// we need to open the file for writing, but we failed to do so.
|
||||
@@ -1094,8 +1095,8 @@ namespace AZ::IO
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
size_t Archive::FReadRaw(void* pData, size_t nSize, size_t nCount, AZ::IO::HandleType fileHandle)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore);
|
||||
AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Game, "Size: %d Archive: %p", nSize, this);
|
||||
AZ_PROFILE_FUNCTION(AzCore);
|
||||
AZ_PROFILE_SCOPE(Game, "Size: %d Archive: %p", nSize, this);
|
||||
SAutoCollectFileAccessTime accessTime(this);
|
||||
|
||||
ArchiveInternal::CZipPseudoFile* pseudoFile = GetPseudoFile(fileHandle);
|
||||
@@ -1112,7 +1113,7 @@ namespace AZ::IO
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
size_t Archive::FReadRawAll(void* pData, size_t nFileSize, AZ::IO::HandleType fileHandle)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore);
|
||||
AZ_PROFILE_FUNCTION(AzCore);
|
||||
|
||||
SAutoCollectFileAccessTime accessTime(this);
|
||||
ArchiveInternal::CZipPseudoFile* pseudoFile = GetPseudoFile(fileHandle);
|
||||
@@ -1130,7 +1131,7 @@ namespace AZ::IO
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void* Archive::FGetCachedFileData(AZ::IO::HandleType fileHandle, size_t& nFileSize)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore);
|
||||
AZ_PROFILE_FUNCTION(AzCore);
|
||||
|
||||
SAutoCollectFileAccessTime accessTime(this);
|
||||
ArchiveInternal::CZipPseudoFile* pseudoFile = GetPseudoFile(fileHandle);
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace AzFramework
|
||||
//=========================================================================
|
||||
void EntityContext::HandleEntitiesAdded(const EntityList& entities)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
|
||||
for (AZ::Entity* entity : entities)
|
||||
{
|
||||
@@ -184,7 +184,7 @@ namespace AzFramework
|
||||
//=========================================================================
|
||||
void EntityContext::HandleEntitiesRemoved(const EntityIdList& entityIds)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
|
||||
for (AZ::EntityId id : entityIds)
|
||||
{
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace AzFramework
|
||||
|
||||
void SliceEntityOwnershipService::CreateRootSlice()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
|
||||
AZ_Assert(m_rootAsset && m_rootAsset.Get(), "Root slice asset has not been created yet.");
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace AzFramework
|
||||
|
||||
void SliceEntityOwnershipService::CreateRootSlice(AZ::SliceAsset* rootSliceAsset)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
AZ_Assert(m_rootAsset && m_rootAsset.Get(), "Root slice asset has not been created yet.");
|
||||
|
||||
AZ::Entity* rootEntity = new AZ::Entity();
|
||||
@@ -240,7 +240,7 @@ namespace AzFramework
|
||||
|
||||
bool SliceEntityOwnershipService::LoadFromStream(AZ::IO::GenericStream& stream, bool remapIds, EntityIdToEntityIdMap* idRemapTable, const AZ::ObjectStream::FilterDescriptor& filterDesc)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
|
||||
AZ_Assert(m_rootAsset, "The entity ownership service has not been initialized.");
|
||||
|
||||
@@ -259,7 +259,7 @@ namespace AzFramework
|
||||
bool SliceEntityOwnershipService::HandleRootEntityReloadedFromStream(AZ::Entity* rootEntity, bool remapIds,
|
||||
AZ::SliceComponent::EntityIdToEntityIdMap* idRemapTable)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
|
||||
if (!rootEntity)
|
||||
{
|
||||
@@ -385,7 +385,7 @@ namespace AzFramework
|
||||
|
||||
void SliceEntityOwnershipService::OnAssetReady(AZ::Data::Asset<AZ::Data::AssetData> readyAsset)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
AZ_ASSET_ATTACH_TO_SCOPE(readyAsset.Get());
|
||||
|
||||
AZ_Assert(readyAsset.GetAs<AZ::SliceAsset>(), "Asset is not a slice!");
|
||||
@@ -472,7 +472,7 @@ namespace AzFramework
|
||||
|
||||
void SliceEntityOwnershipService::OnAssetReloaded(AZ::Data::Asset<AZ::Data::AssetData> asset)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
if (asset == m_rootAsset && asset.Get() != m_rootAsset.Get())
|
||||
{
|
||||
Reset();
|
||||
@@ -548,7 +548,7 @@ namespace AzFramework
|
||||
AZ::SliceComponent::SliceInstanceAddress SliceEntityOwnershipService::CloneSliceInstance(
|
||||
AZ::SliceComponent::SliceInstanceAddress sourceInstance, AZ::SliceComponent::EntityIdToEntityIdMap& sourceToCloneEntityIdMap)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
|
||||
AZ_Assert(sourceInstance.IsValid(), "Source slice instance is invalid.");
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace AzFramework
|
||||
{
|
||||
using namespace AZ::IO;
|
||||
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore);
|
||||
AZ_PROFILE_FUNCTION(AzCore);
|
||||
AZ_Assert(request, "PrepareRequest was provided a null request.");
|
||||
|
||||
if (AZStd::holds_alternative<FileRequest::ReadRequestData>(request->GetCommand()))
|
||||
@@ -278,7 +278,7 @@ namespace AzFramework
|
||||
{
|
||||
using namespace AZ::IO;
|
||||
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore);
|
||||
AZ_PROFILE_FUNCTION(AzCore);
|
||||
|
||||
auto data = AZStd::get_if<FileRequest::ReadData>(&request->GetCommand());
|
||||
AZ_Assert(data, "Request doing reading in the RemoteStorageDrive didn't contain read data.")
|
||||
@@ -424,7 +424,7 @@ namespace AzFramework
|
||||
{
|
||||
using namespace AZ::IO;
|
||||
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore);
|
||||
AZ_PROFILE_FUNCTION(AzCore);
|
||||
TIMED_AVERAGE_WINDOW_SCOPE(m_getFileMetaDataTimeAverage);
|
||||
|
||||
AZ::u64 fileSize = 0;
|
||||
|
||||
@@ -619,7 +619,7 @@ namespace AzFramework
|
||||
//=========================================================================
|
||||
void ScriptComponent::LoadScript()
|
||||
{
|
||||
AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Script, "Load: %s", m_script.GetHint().c_str());
|
||||
AZ_PROFILE_SCOPE(Script, "Load: %s", m_script.GetHint().c_str());
|
||||
|
||||
// Load the script, find the base table, create the entity table
|
||||
// find the Activate/Deactivate functions in the script and call them
|
||||
@@ -634,7 +634,7 @@ namespace AzFramework
|
||||
//=========================================================================
|
||||
void ScriptComponent::UnloadScript()
|
||||
{
|
||||
AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Script, "Unload: %s", m_script.GetHint().c_str());
|
||||
AZ_PROFILE_SCOPE(Script, "Unload: %s", m_script.GetHint().c_str());
|
||||
|
||||
DestroyEntityTable();
|
||||
}
|
||||
@@ -822,7 +822,7 @@ namespace AzFramework
|
||||
lua_rawget(lua, baseStackIndex); // ScriptTable[OnActivate]
|
||||
if (lua_isfunction(lua, -1))
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Script, "OnActivate");
|
||||
AZ_PROFILE_SCOPE(Script, "OnActivate");
|
||||
lua_rawgeti(lua, LUA_REGISTRYINDEX, m_table); // push the entity table as the only argument
|
||||
AZ::Internal::LuaSafeCall(lua, 1, 0); // Call OnActivate
|
||||
}
|
||||
@@ -856,7 +856,7 @@ namespace AzFramework
|
||||
lua_rawget(lua, -2); // ScriptTable[OnDeactivte]
|
||||
if (lua_isfunction(lua, -1))
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Script, "OnDeactivate");
|
||||
AZ_PROFILE_SCOPE(Script, "OnDeactivate");
|
||||
|
||||
lua_pushvalue(lua, -3); // push the entity table as the only argument
|
||||
AZ::Internal::LuaSafeCall(lua, 1, 0); // Call OnDeactivate
|
||||
|
||||
+5
-5
@@ -625,7 +625,7 @@ namespace AzFramework
|
||||
return;
|
||||
}
|
||||
|
||||
AZ_PROFILE_TIMER("TargetManager");
|
||||
AZ_PROFILE_SCOPE(AzFramework, "TargetManager::SendTmMessage");
|
||||
AZStd::vector<char, AZ::OSStdAllocator> msgBuffer;
|
||||
AZ::IO::ByteContainerStream<AZStd::vector<char, AZ::OSStdAllocator> > outMsg(&msgBuffer);
|
||||
|
||||
@@ -651,7 +651,7 @@ namespace AzFramework
|
||||
|
||||
void TargetManagementComponent::DispatchMessages(MsgSlotId id)
|
||||
{
|
||||
AZ_PROFILE_TIMER("TargetManager");
|
||||
AZ_PROFILE_SCOPE(AzFramework, "TargetManager::DispatchMessages");
|
||||
AZStd::lock_guard<AZStd::mutex> lock(m_inboxMutex);
|
||||
size_t maxMsgsToProcess = m_inbox.size();
|
||||
TmMsgQueue::iterator itMsg = m_inbox.begin();
|
||||
@@ -684,7 +684,7 @@ namespace AzFramework
|
||||
{
|
||||
if (m_networkImpl->m_gridMate)
|
||||
{
|
||||
AZ_PROFILE_TIMER("TargetManager");
|
||||
AZ_PROFILE_SCOPE(AzFramework, "TargetManager::Tick");
|
||||
if (!m_networkImpl->m_session && !m_networkImpl->m_gridSearch)
|
||||
{
|
||||
if (AZStd::chrono::system_clock::now() > m_reconnectionTime)
|
||||
@@ -694,7 +694,7 @@ namespace AzFramework
|
||||
}
|
||||
|
||||
{
|
||||
AZ_PROFILE_TIMER("TargetManager", "Tick Gridmate");
|
||||
AZ_PROFILE_SCOPE(AzFramework, "TargetManager::Tick Gridmate");
|
||||
m_networkImpl->m_gridMate->Update();
|
||||
if (m_networkImpl->m_session && m_networkImpl->m_session->GetReplicaMgr())
|
||||
{
|
||||
@@ -707,7 +707,7 @@ namespace AzFramework
|
||||
|
||||
if (m_networkImpl->m_session)
|
||||
{
|
||||
AZ_PROFILE_TIMER("TargetManager", "Send/Receive TmMsgs");
|
||||
AZ_PROFILE_SCOPE(AzFramework, "TargetManager::Tick Send/Receive TmMsgs");
|
||||
|
||||
// Receive
|
||||
for (unsigned int i = 0; i < m_networkImpl->m_session->GetNumberOfMembers(); ++i)
|
||||
|
||||
+6
-5
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "EntityVisibilityBoundsUnionSystem.h"
|
||||
|
||||
#include <AzCore/Debug/Profiler.h>
|
||||
#include <AzFramework/Visibility/BoundsBus.h>
|
||||
#include <cstring>
|
||||
|
||||
@@ -42,7 +43,7 @@ namespace AzFramework
|
||||
|
||||
void EntityVisibilityBoundsUnionSystem::OnEntityActivated(AZ::Entity* entity)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
|
||||
// ignore any entity that might activate which does not have a TransformComponent
|
||||
if (entity->GetTransform() == nullptr)
|
||||
@@ -68,7 +69,7 @@ namespace AzFramework
|
||||
|
||||
void EntityVisibilityBoundsUnionSystem::OnEntityDeactivated(AZ::Entity* entity)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
|
||||
// ignore any entity that might deactivate which does not have a TransformComponent
|
||||
if (entity->GetTransform() == nullptr)
|
||||
@@ -89,7 +90,7 @@ namespace AzFramework
|
||||
|
||||
void EntityVisibilityBoundsUnionSystem::UpdateVisibilitySystem(AZ::Entity* entity, EntityVisibilityBoundsUnionInstance& instance)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
|
||||
if (const auto& localEntityBoundsUnions = instance.m_localEntityBoundsUnion; localEntityBoundsUnions.IsValid())
|
||||
{
|
||||
@@ -136,7 +137,7 @@ namespace AzFramework
|
||||
|
||||
void EntityVisibilityBoundsUnionSystem::ProcessEntityBoundsUnionRequests()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
|
||||
// iterate over all entities whose bounds changed and recalculate them
|
||||
for (const auto& entity : m_entityBoundsDirty)
|
||||
@@ -155,7 +156,7 @@ namespace AzFramework
|
||||
|
||||
void EntityVisibilityBoundsUnionSystem::OnTransformUpdated(AZ::Entity* entity)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
|
||||
// update the world transform of the visibility bounds union
|
||||
if (auto instance_it = m_entityVisibilityBoundsUnionInstanceMapping.find(entity);
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace AzFramework
|
||||
{
|
||||
void EntityVisibilityQuery::UpdateVisibility(const AzFramework::CameraState& cameraState)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework);
|
||||
AZ_PROFILE_FUNCTION(AzFramework);
|
||||
|
||||
auto* visSystem = AZ::Interface<AzFramework::IVisibilitySystem>::Get();
|
||||
if (!visSystem)
|
||||
|
||||
Reference in New Issue
Block a user