_setidealprocessor
This commit is contained in:
@@ -70,7 +70,7 @@ void SceneRendering::Draw(RenderContextBatch& renderContextBatch, DrawCategory c
|
|||||||
|
|
||||||
// Draw all visual components
|
// Draw all visual components
|
||||||
_drawListIndex = -1;
|
_drawListIndex = -1;
|
||||||
if (_drawListSize >= 64 && category == SceneDrawAsync && renderContextBatch.EnableAsync)
|
/*if (_drawListSize >= 64 && category == SceneDrawAsync && renderContextBatch.EnableAsync)
|
||||||
{
|
{
|
||||||
// Run in async via Job System
|
// Run in async via Job System
|
||||||
Function<void(int32)> func;
|
Function<void(int32)> func;
|
||||||
@@ -78,7 +78,7 @@ void SceneRendering::Draw(RenderContextBatch& renderContextBatch, DrawCategory c
|
|||||||
const uint64 waitLabel = JobSystem::Dispatch(func, JobSystem::GetThreadsCount());
|
const uint64 waitLabel = JobSystem::Dispatch(func, JobSystem::GetThreadsCount());
|
||||||
renderContextBatch.WaitLabels.Add(waitLabel);
|
renderContextBatch.WaitLabels.Add(waitLabel);
|
||||||
}
|
}
|
||||||
else
|
else*/
|
||||||
{
|
{
|
||||||
// Scene is small so draw on a main-thread
|
// Scene is small so draw on a main-thread
|
||||||
DrawActorsJob(0);
|
DrawActorsJob(0);
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ public:
|
|||||||
static void SetThreadPriority(ThreadPriority priority) = delete;
|
static void SetThreadPriority(ThreadPriority priority) = delete;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets a processor affinity mask for the specified thread.
|
/// Sets a processor affinity mask for the current thread.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// A thread affinity mask is a bit vector in which each bit represents a logical processor that a thread is allowed to run on. A thread affinity mask must be a subset of the process affinity mask for the containing process of a thread. A thread can only run on the processors its process can run on. Therefore, the thread affinity mask cannot specify a 1 bit for a processor when the process affinity mask specifies a 0 bit for that processor.
|
/// A thread affinity mask is a bit vector in which each bit represents a logical processor that a thread is allowed to run on. A thread affinity mask must be a subset of the process affinity mask for the containing process of a thread. A thread can only run on the processors its process can run on. Therefore, the thread affinity mask cannot specify a 1 bit for a processor when the process affinity mask specifies a 0 bit for that processor.
|
||||||
@@ -400,6 +400,12 @@ public:
|
|||||||
/// <param name="affinityMask">The affinity mask for the thread.</param>
|
/// <param name="affinityMask">The affinity mask for the thread.</param>
|
||||||
static void SetThreadAffinityMask(uint64 affinityMask) = delete;
|
static void SetThreadAffinityMask(uint64 affinityMask) = delete;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets a preferred processor for the current thread.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="affinityMask">The preferred processor number.</param>
|
||||||
|
static void SetThreadIdealProcessor(uint32 idealProcessor) = delete;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Suspends the execution of the current thread until the time-out interval elapses
|
/// Suspends the execution of the current thread until the time-out interval elapses
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -368,6 +368,11 @@ void Win32Platform::SetThreadAffinityMask(uint64 affinityMask)
|
|||||||
::SetThreadAffinityMask(::GetCurrentThread(), (DWORD_PTR)affinityMask);
|
::SetThreadAffinityMask(::GetCurrentThread(), (DWORD_PTR)affinityMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Win32Platform::SetThreadIdealProcessor(uint32 idealProcessor)
|
||||||
|
{
|
||||||
|
::SetThreadIdealProcessor(::GetCurrentThread(), idealProcessor);
|
||||||
|
}
|
||||||
|
|
||||||
void Win32Platform::Sleep(int32 milliseconds)
|
void Win32Platform::Sleep(int32 milliseconds)
|
||||||
{
|
{
|
||||||
if (milliseconds < 0)
|
if (milliseconds < 0)
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ public:
|
|||||||
}
|
}
|
||||||
static void SetThreadPriority(ThreadPriority priority);
|
static void SetThreadPriority(ThreadPriority priority);
|
||||||
static void SetThreadAffinityMask(uint64 affinityMask);
|
static void SetThreadAffinityMask(uint64 affinityMask);
|
||||||
|
static void SetThreadIdealProcessor(uint32 idealProcessor);
|
||||||
static void Sleep(int32 milliseconds);
|
static void Sleep(int32 milliseconds);
|
||||||
static double GetTimeSeconds();
|
static double GetTimeSeconds();
|
||||||
static uint64 GetTimeCycles();
|
static uint64 GetTimeCycles();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "Engine/Core/Collections/Dictionary.h"
|
#include "Engine/Core/Collections/Dictionary.h"
|
||||||
#include "Engine/Engine/EngineService.h"
|
#include "Engine/Engine/EngineService.h"
|
||||||
#include "Engine/Profiler/ProfilerCPU.h"
|
#include "Engine/Profiler/ProfilerCPU.h"
|
||||||
|
#include "Engine/Platform/Win32/IncludeWindowsHeaders.h"
|
||||||
#if USE_CSHARP
|
#if USE_CSHARP
|
||||||
#include "Engine/Scripting/ManagedCLR/MCore.h"
|
#include "Engine/Scripting/ManagedCLR/MCore.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -155,7 +156,8 @@ void JobSystemService::Dispose()
|
|||||||
|
|
||||||
int32 JobSystemThread::Run()
|
int32 JobSystemThread::Run()
|
||||||
{
|
{
|
||||||
Platform::SetThreadAffinityMask(1ull << Index);
|
//Platform::SetThreadAffinityMask(1ull << Index);
|
||||||
|
Platform::SetThreadIdealProcessor((uint32)Index);
|
||||||
|
|
||||||
JobData data;
|
JobData data;
|
||||||
bool attachCSharpThread = true;
|
bool attachCSharpThread = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user