Implement scheduling system with parallel execution support and dummy job systems
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using MoonTools.ECS;
|
||||
using Nerfed.Runtime.Scheduling;
|
||||
|
||||
namespace Nerfed.Runtime.Systems.Synthetic;
|
||||
|
||||
public sealed class DummyMainThreadWorkSystem : MoonTools.ECS.System, IParallelSystemMetadata
|
||||
{
|
||||
private readonly TimeSpan duration;
|
||||
private readonly DummyWorkloadMode mode;
|
||||
private readonly string scheduleName;
|
||||
private int seed;
|
||||
|
||||
public DummyMainThreadWorkSystem(
|
||||
World world,
|
||||
TimeSpan duration,
|
||||
DummyWorkloadMode mode,
|
||||
string scheduleName,
|
||||
int initialSeed = 1) : base(world)
|
||||
{
|
||||
this.duration = duration;
|
||||
this.mode = mode;
|
||||
this.scheduleName = scheduleName;
|
||||
seed = initialSeed;
|
||||
}
|
||||
|
||||
public string ScheduleName => scheduleName;
|
||||
|
||||
public SystemAccessDeclaration AccessDeclaration => SystemAccessDeclaration.Empty;
|
||||
|
||||
public override void Update(TimeSpan delta)
|
||||
{
|
||||
seed = DummyWorkloadRunner.Run(duration, mode, seed);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user