Add more profile events to assets data loading
This commit is contained in:
@@ -165,7 +165,7 @@ bool ContentLoadingManagerService::Init()
|
|||||||
|
|
||||||
// Calculate amount of loading threads to use
|
// Calculate amount of loading threads to use
|
||||||
const CPUInfo cpuInfo = Platform::GetCPUInfo();
|
const CPUInfo cpuInfo = Platform::GetCPUInfo();
|
||||||
const int32 count = static_cast<int32>(Math::Clamp(LOADING_THREAD_PER_PHYSICAL_CORE * cpuInfo.ProcessorCoreCount, 1.0f, 4.0f));
|
const int32 count = Math::Clamp(static_cast<int32>(LOADING_THREAD_PER_PHYSICAL_CORE * (float)cpuInfo.ProcessorCoreCount), 1, 6);
|
||||||
LOG(Info, "Creating {0} content loading threads...", count);
|
LOG(Info, "Creating {0} content loading threads...", count);
|
||||||
|
|
||||||
// Create loading threads
|
// Create loading threads
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ protected:
|
|||||||
AssetReference<BinaryAsset> ref = _asset.Get();
|
AssetReference<BinaryAsset> ref = _asset.Get();
|
||||||
if (ref == nullptr)
|
if (ref == nullptr)
|
||||||
return Result::MissingReferences;
|
return Result::MissingReferences;
|
||||||
|
#if TRACY_ENABLE
|
||||||
|
const StringView name(ref->GetPath());
|
||||||
|
#endif
|
||||||
|
|
||||||
// Load chunks
|
// Load chunks
|
||||||
for (int32 i = 0; i < ASSET_FILE_DATA_CHUNKS; i++)
|
for (int32 i = 0; i < ASSET_FILE_DATA_CHUNKS; i++)
|
||||||
@@ -62,11 +65,14 @@ protected:
|
|||||||
const auto chunk = ref->GetChunk(i);
|
const auto chunk = ref->GetChunk(i);
|
||||||
if (chunk != nullptr)
|
if (chunk != nullptr)
|
||||||
{
|
{
|
||||||
// Check for cancel
|
|
||||||
if (IsCancelRequested())
|
if (IsCancelRequested())
|
||||||
return Result::Ok;
|
return Result::Ok;
|
||||||
|
|
||||||
// Load it
|
// Load it
|
||||||
|
#if TRACY_ENABLE
|
||||||
|
ZoneScoped;
|
||||||
|
ZoneName(*name, name.Length());
|
||||||
|
#endif
|
||||||
if (ref->Storage->LoadAssetChunk(chunk))
|
if (ref->Storage->LoadAssetChunk(chunk))
|
||||||
{
|
{
|
||||||
LOG(Warning, "Cannot load asset \'{0}\' chunk {1}.", ref->ToString(), i);
|
LOG(Warning, "Cannot load asset \'{0}\' chunk {1}.", ref->ToString(), i);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "Engine/Core/Log.h"
|
#include "Engine/Core/Log.h"
|
||||||
#include "Engine/Core/Types/TimeSpan.h"
|
#include "Engine/Core/Types/TimeSpan.h"
|
||||||
#include "Engine/Platform/File.h"
|
#include "Engine/Platform/File.h"
|
||||||
|
#include "Engine/Profiler/ProfilerCPU.h"
|
||||||
#include "Engine/Serialization/FileWriteStream.h"
|
#include "Engine/Serialization/FileWriteStream.h"
|
||||||
#if USE_EDITOR
|
#if USE_EDITOR
|
||||||
#include "Engine/Serialization/JsonWriter.h"
|
#include "Engine/Serialization/JsonWriter.h"
|
||||||
@@ -628,6 +629,7 @@ bool FlaxStorage::LoadAssetChunk(FlaxChunk* chunk)
|
|||||||
stream->ReadBytes(tmpBuf.Get(), size);
|
stream->ReadBytes(tmpBuf.Get(), size);
|
||||||
|
|
||||||
// Decompress data
|
// Decompress data
|
||||||
|
PROFILE_CPU_NAMED("DecompressLZ4");
|
||||||
chunk->Data.Allocate(originalSize);
|
chunk->Data.Allocate(originalSize);
|
||||||
const int32 res = LZ4_decompress_safe((const char*)tmpBuf.Get(), chunk->Data.Get<char>(), size, originalSize);
|
const int32 res = LZ4_decompress_safe((const char*)tmpBuf.Get(), chunk->Data.Get<char>(), size, originalSize);
|
||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
@@ -828,6 +830,7 @@ bool FlaxStorage::Create(WriteStream* stream, const AssetInitData* data, int32 d
|
|||||||
const FlaxChunk* chunk = chunks[i];
|
const FlaxChunk* chunk = chunks[i];
|
||||||
if (chunk->Flags & FlaxChunkFlags::CompressedLZ4)
|
if (chunk->Flags & FlaxChunkFlags::CompressedLZ4)
|
||||||
{
|
{
|
||||||
|
PROFILE_CPU_NAMED("CompressLZ4");
|
||||||
const int32 srcSize = chunk->Data.Length();
|
const int32 srcSize = chunk->Data.Length();
|
||||||
const int32 maxSize = LZ4_compressBound(srcSize);
|
const int32 maxSize = LZ4_compressBound(srcSize);
|
||||||
auto& chunkCompressed = compressedChunks[i];
|
auto& chunkCompressed = compressedChunks[i];
|
||||||
|
|||||||
Reference in New Issue
Block a user