LeviLamina
Loading...
Searching...
No Matches
Scheduler.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
7#include "mc/platform/brstd/move_only_function.h"
8
9// auto generated forward declare list
10// clang-format off
12class WorkerPool;
13// clang-format on
14
15class Scheduler : public ::Bedrock::EnableNonOwnerReferences {
16public:
17 // Scheduler inner types declare
18 // clang-format off
19 struct CoroutinePolicy;
21 // clang-format on
22
23 // Scheduler inner types define
24 enum class MaximumTimeBudget : int {
25 Yes = 0,
26 No = 1,
27 };
28
29 enum class MinimumTimeBudget : int {
30 Yes = 0,
31 No = 1,
32 };
33
34 struct CoroutinePolicy {
35 public:
36 // member variables
37 // NOLINTBEGIN
40 // NOLINTEND
41
42 public:
43 // prevent constructor by default
44 CoroutinePolicy& operator=(CoroutinePolicy const&);
45 CoroutinePolicy(CoroutinePolicy const&);
46 CoroutinePolicy();
47 };
48
49 class ScopedChangeScheduler {
50 public:
51 // member variables
52 // NOLINTBEGIN
54 // NOLINTEND
55
56 public:
57 // prevent constructor by default
58 ScopedChangeScheduler& operator=(ScopedChangeScheduler const&);
59 ScopedChangeScheduler(ScopedChangeScheduler const&);
60 ScopedChangeScheduler();
61 };
62
63public:
64 // member variables
65 // NOLINTBEGIN
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;
78 // NOLINTEND
79
80public:
81 // prevent constructor by default
82 Scheduler();
83
84public:
85 // virtual functions
86 // NOLINTBEGIN
87#ifdef LL_PLAT_S
88 virtual ~Scheduler() /*override*/ = default;
89#else // LL_PLAT_C
90 virtual ~Scheduler() /*override*/;
91#endif
92
93 // NOLINTEND
94
95public:
96 // member functions
97 // NOLINTBEGIN
98 MCAPI Scheduler(::std::string_view name, uint FPS);
99
100 MCAPI ::std::chrono::nanoseconds _calcBaseTimeBudget(
101 uint forFps,
102 ::std::chrono::nanoseconds frameTimeSoFar,
103 ::Scheduler::MinimumTimeBudget ensureNonZeroRunTime,
104 ::Scheduler::MaximumTimeBudget limitMaxRunTime
105 );
106
107 MCAPI bool _runCoroutines(::std::chrono::nanoseconds timeCap);
108
109 MCAPI void changeThread(::std::thread::id newOwner);
110
111 MCFOLD ::WorkerPool& getCoroutinePool();
112
113 MCAPI void processCoroutines(
114 ::std::chrono::nanoseconds timeSinceSwap,
115 ::Scheduler::MinimumTimeBudget ensureNonZeroRunTime,
116 ::Scheduler::MaximumTimeBudget limitMaxRunTime
117 );
118
119 MCAPI void queueCallback(::std::shared_ptr<::BackgroundTaskBase> task);
120
121#ifdef LL_PLAT_C
122 MCAPI ::std::shared_ptr<void> setCoroutinePolicy(::brstd::move_only_function<bool() const> policy);
123#endif
124
125 MCAPI void setTargetFPS(uint FPS);
126
127 MCAPI void updateTargetFPS();
128 // NOLINTEND
129
130public:
131 // constructor thunks
132 // NOLINTBEGIN
133 MCAPI void* $ctor(::std::string_view name, uint FPS);
134 // NOLINTEND
135
136public:
137 // destructor thunk
138 // NOLINTBEGIN
139 MCAPI void $dtor();
140 // NOLINTEND
141
142public:
143 // vftables
144 // NOLINTBEGIN
145 MCNAPI static void** $vftable();
146 // NOLINTEND
147};
Definition BackgroundTaskBase.h:16
Definition EnableNonOwnerReferences.h:7
Definition Scheduler.h:49
static MCAPI void ** $vftable()
Definition WorkerPool.h:20
Definition move_only_function.h:9
Definition Scheduler.h:34
Definition Alias.h:14