Add profiler event to task wait method

This commit is contained in:
Wojtek Figat
2024-02-20 12:59:00 +01:00
parent 1cb88bdc63
commit e255778c07

View File

@@ -7,6 +7,7 @@
#include "Engine/Core/Types/DateTime.h" #include "Engine/Core/Types/DateTime.h"
#include "Engine/Core/Collections/Array.h" #include "Engine/Core/Collections/Array.h"
#include "Engine/Core/Math/Math.h" #include "Engine/Core/Math/Math.h"
#include "Engine/Profiler/ProfilerCPU.h"
void Task::Start() void Task::Start()
{ {
@@ -37,6 +38,7 @@ void Task::Cancel()
bool Task::Wait(double timeoutMilliseconds) const bool Task::Wait(double timeoutMilliseconds) const
{ {
PROFILE_CPU();
double startTime = Platform::GetTimeSeconds() * 0.001; double startTime = Platform::GetTimeSeconds() * 0.001;
// TODO: no active waiting! use a semaphore! // TODO: no active waiting! use a semaphore!
@@ -73,12 +75,9 @@ bool Task::Wait(double timeoutMilliseconds) const
Task* Task::ContinueWith(Task* task) Task* Task::ContinueWith(Task* task)
{ {
ASSERT(task != nullptr && task != this); ASSERT(task != nullptr && task != this);
if (_continueWith) if (_continueWith)
return _continueWith->ContinueWith(task); return _continueWith->ContinueWith(task);
_continueWith = task; _continueWith = task;
return task; return task;
} }