24 enum class MaximumTimeBudget :
int {
29 enum class MinimumTimeBudget :
int {
34 struct CoroutinePolicy {
44 CoroutinePolicy& operator=(CoroutinePolicy
const&);
45 CoroutinePolicy(CoroutinePolicy
const&);
49 class ScopedChangeScheduler {
58 ScopedChangeScheduler& operator=(ScopedChangeScheduler
const&);
59 ScopedChangeScheduler(ScopedChangeScheduler
const&);
60 ScopedChangeScheduler();
66 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::Scheduler::CoroutinePolicy>> mCoroutinePolicy;
67 ::ll::TypedStorage<4, 4, uint> mTotalFrames;
68 ::ll::TypedStorage<4, 4, uint> mStarvedFrames;
69 ::ll::TypedStorage<4, 4, uint> mPromotionFrames;
70 ::ll::TypedStorage<4, 4, uint> mTargetFPS;
71 ::ll::TypedStorage<4, 4, uint> mEffectiveFPS;
72 ::ll::TypedStorage<4, 4, uint> mTotalRunCoroutines;
73 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> mPredictedCoroutineDuration;
74 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> mTotalCoroutineDuration;
75 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::WorkerPool>> mCoroutinePool;
76 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mNextStarveCheckTime;
77 ::ll::TypedStorage<4, 4, ::std::thread::id> mThreadID;
88 virtual ~Scheduler() =
default;
90 virtual ~Scheduler() ;
98 MCAPI Scheduler(::std::string_view name, uint FPS);
100 MCAPI ::std::chrono::nanoseconds _calcBaseTimeBudget(
102 ::std::chrono::nanoseconds frameTimeSoFar,
103 ::Scheduler::MinimumTimeBudget ensureNonZeroRunTime,
104 ::Scheduler::MaximumTimeBudget limitMaxRunTime
107 MCAPI
bool _runCoroutines(::std::chrono::nanoseconds timeCap);
109 MCAPI
void changeThread(::std::thread::id newOwner);
111 MCFOLD ::WorkerPool& getCoroutinePool();
113 MCAPI
void processCoroutines(
114 ::std::chrono::nanoseconds timeSinceSwap,
115 ::Scheduler::MinimumTimeBudget ensureNonZeroRunTime,
116 ::Scheduler::MaximumTimeBudget limitMaxRunTime
119 MCAPI
void queueCallback(::std::shared_ptr<::BackgroundTaskBase> task);
125 MCAPI
void setTargetFPS(uint FPS);
127 MCAPI
void updateTargetFPS();
133 MCAPI
void* $ctor(::std::string_view name, uint FPS);