diff --git a/Source/Engine/Content/Loading/ContentLoadingManager.cpp b/Source/Engine/Content/Loading/ContentLoadingManager.cpp index 6e6ff7a65..5f75e8cd1 100644 --- a/Source/Engine/Content/Loading/ContentLoadingManager.cpp +++ b/Source/Engine/Content/Loading/ContentLoadingManager.cpp @@ -165,7 +165,7 @@ bool ContentLoadingManagerService::Init() // Calculate amount of loading threads to use const CPUInfo cpuInfo = Platform::GetCPUInfo(); - const int32 count = static_cast(Math::Clamp(LOADING_THREAD_PER_PHYSICAL_CORE * cpuInfo.ProcessorCoreCount, 1.0f, 4.0f)); + const int32 count = Math::Clamp(static_cast(LOADING_THREAD_PER_PHYSICAL_CORE * (float)cpuInfo.ProcessorCoreCount), 1, 6); LOG(Info, "Creating {0} content loading threads...", count); // Create loading threads diff --git a/Source/Engine/Content/Loading/Tasks/LoadAssetDataTask.h b/Source/Engine/Content/Loading/Tasks/LoadAssetDataTask.h index 5d552b996..752fa7bc4 100644 --- a/Source/Engine/Content/Loading/Tasks/LoadAssetDataTask.h +++ b/Source/Engine/Content/Loading/Tasks/LoadAssetDataTask.h @@ -53,6 +53,9 @@ protected: AssetReference ref = _asset.Get(); if (ref == nullptr) return Result::MissingReferences; +#if TRACY_ENABLE + const StringView name(ref->GetPath()); +#endif // Load chunks for (int32 i = 0; i < ASSET_FILE_DATA_CHUNKS; i++) @@ -62,11 +65,14 @@ protected: const auto chunk = ref->GetChunk(i); if (chunk != nullptr) { - // Check for cancel if (IsCancelRequested()) return Result::Ok; // Load it +#if TRACY_ENABLE + ZoneScoped; + ZoneName(*name, name.Length()); +#endif if (ref->Storage->LoadAssetChunk(chunk)) { LOG(Warning, "Cannot load asset \'{0}\' chunk {1}.", ref->ToString(), i); diff --git a/Source/Engine/Content/Storage/FlaxStorage.cpp b/Source/Engine/Content/Storage/FlaxStorage.cpp index bc2cfd332..50ed82595 100644 --- a/Source/Engine/Content/Storage/FlaxStorage.cpp +++ b/Source/Engine/Content/Storage/FlaxStorage.cpp @@ -7,6 +7,7 @@ #include "Engine/Core/Log.h" #include "Engine/Core/Types/TimeSpan.h" #include "Engine/Platform/File.h" +#include "Engine/Profiler/ProfilerCPU.h" #include "Engine/Serialization/FileWriteStream.h" #if USE_EDITOR #include "Engine/Serialization/JsonWriter.h" @@ -628,6 +629,7 @@ bool FlaxStorage::LoadAssetChunk(FlaxChunk* chunk) stream->ReadBytes(tmpBuf.Get(), size); // Decompress data + PROFILE_CPU_NAMED("DecompressLZ4"); chunk->Data.Allocate(originalSize); const int32 res = LZ4_decompress_safe((const char*)tmpBuf.Get(), chunk->Data.Get(), size, originalSize); if (res <= 0) @@ -828,6 +830,7 @@ bool FlaxStorage::Create(WriteStream* stream, const AssetInitData* data, int32 d const FlaxChunk* chunk = chunks[i]; if (chunk->Flags & FlaxChunkFlags::CompressedLZ4) { + PROFILE_CPU_NAMED("CompressLZ4"); const int32 srcSize = chunk->Data.Length(); const int32 maxSize = LZ4_compressBound(srcSize); auto& chunkCompressed = compressedChunks[i];