Add Stopwatch for accurate duration measuring

This commit is contained in:
Wojtek Figat
2024-01-28 20:31:03 +01:00
parent ecf593e7a4
commit 69b7a10c1f
10 changed files with 113 additions and 41 deletions

View File

@@ -4,6 +4,8 @@
#include "Engine/Core/Log.h"
#include "Engine/Core/DeleteMe.h"
#include "Engine/Core/Types/TimeSpan.h"
#include "Engine/Core/Types/DateTime.h"
#include "Engine/Core/Types/Stopwatch.h"
#include "Engine/Platform/FileSystem.h"
#include "Engine/Serialization/FileWriteStream.h"
#include "Engine/Serialization/FileReadStream.h"
@@ -19,7 +21,7 @@ void AssetsCache::Init()
{
Entry e;
int32 count;
const DateTime loadStartTime = DateTime::Now();
Stopwatch stopwatch;
#if USE_EDITOR
_path = Globals::ProjectCacheFolder / TEXT("AssetsCache.dat");
#else
@@ -138,8 +140,8 @@ void AssetsCache::Init()
}
}
const int32 loadTimeInMs = static_cast<int32>((DateTime::Now() - loadStartTime).GetTotalMilliseconds());
LOG(Info, "Asset Cache loaded {0} entries in {1} ms ({2} rejected)", _registry.Count(), loadTimeInMs, rejectedCount);
stopwatch.Stop();
LOG(Info, "Asset Cache loaded {0} entries in {1} ms ({2} rejected)", _registry.Count(), stopwatch.GetMilliseconds(), rejectedCount);
}
bool AssetsCache::Save()