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
11class WorkerPool;
12// clang-format on
13
14class Scheduler : public ::Bedrock::EnableNonOwnerReferences {
15public:
16 // Scheduler inner types declare
17 // clang-format off
18 struct CoroutinePolicy;
20 // clang-format on
21
22 // Scheduler inner types define
23 enum class MaximumTimeBudget : int {
24 Yes = 0,
25 No = 1,
26 };
27
28 enum class MinimumTimeBudget : int {
29 Yes = 0,
30 No = 1,
31 };
32
33 struct CoroutinePolicy {
34 public:
35 // member variables
36 // NOLINTBEGIN
39 // NOLINTEND
40
41 public:
42 // prevent constructor by default
43 CoroutinePolicy& operator=(CoroutinePolicy const&);
44 CoroutinePolicy(CoroutinePolicy const&);
45 CoroutinePolicy();
46 };
47
48 class ScopedChangeScheduler {
49 public:
50 // member variables
51 // NOLINTBEGIN
53 // NOLINTEND
54
55 public:
56 // prevent constructor by default
57 ScopedChangeScheduler& operator=(ScopedChangeScheduler const&);
58 ScopedChangeScheduler(ScopedChangeScheduler const&);
59 ScopedChangeScheduler();
60 };
61
62public:
63 // member variables
64 // NOLINTBEGIN
65 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::Scheduler::CoroutinePolicy>> mCoroutinePolicy;
66 ::ll::TypedStorage<4, 4, uint> mTotalFrames;
67 ::ll::TypedStorage<4, 4, uint> mStarvedFrames;
68 ::ll::TypedStorage<4, 4, uint> mPromotionFrames;
69 ::ll::TypedStorage<4, 4, uint> mTargetFPS;
70 ::ll::TypedStorage<4, 4, uint> mEffectiveFPS;
71 ::ll::TypedStorage<4, 4, uint> mTotalRunCoroutines;
72 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> mPredictedCoroutineDuration;
73 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> mTotalCoroutineDuration;
74 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::WorkerPool>> mCoroutinePool;
75 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mNextStarveCheckTime;
76 ::ll::TypedStorage<4, 4, ::std::thread::id> mThreadID;
77 // NOLINTEND
78
79public:
80 // prevent constructor by default
81 Scheduler();
82
83public:
84 // virtual functions
85 // NOLINTBEGIN
86#ifdef LL_PLAT_S
87 virtual ~Scheduler() /*override*/ = default;
88#else // LL_PLAT_C
89 virtual ~Scheduler() /*override*/;
90#endif
91
92 // NOLINTEND
93
94public:
95 // member functions
96 // NOLINTBEGIN
97 MCAPI Scheduler(::std::string name, uint FPS);
98
99 MCAPI ::std::chrono::nanoseconds _calcBaseTimeBudget(
100 uint forFps,
101 ::std::chrono::nanoseconds frameTimeSoFar,
102 ::Scheduler::MinimumTimeBudget ensureNonZeroRunTime,
103 ::Scheduler::MaximumTimeBudget limitMaxRunTime
104 );
105
106 MCAPI bool _runCoroutines(::std::chrono::nanoseconds timeCap);
107
108 MCAPI void processCoroutines(
109 ::std::chrono::nanoseconds timeSinceSwap,
110 ::Scheduler::MinimumTimeBudget ensureNonZeroRunTime,
111 ::Scheduler::MaximumTimeBudget limitMaxRunTime
112 );
113
114 MCAPI_C ::std::shared_ptr<void> setCoroutinePolicy(::brstd::move_only_function<bool() const> policy);
115
116 MCAPI void setTargetFPS(uint FPS);
117
118 MCAPI void updateTargetFPS();
119 // NOLINTEND
120
121public:
122 // constructor thunks
123 // NOLINTBEGIN
124 MCAPI void* $ctor(::std::string name, uint FPS);
125 // NOLINTEND
126
127public:
128 // destructor thunk
129 // NOLINTBEGIN
130 MCAPI void $dtor();
131 // NOLINTEND
132
133public:
134 // vftables
135 // NOLINTBEGIN
136 MCNAPI static void** $vftable();
137 // NOLINTEND
138};
Definition EnableNonOwnerReferences.h:7
Definition Scheduler.h:48
static MCAPI void ** $vftable()
Definition WorkerPool.h:19
Definition move_only_function.h:9
Definition Scheduler.h:33
Definition Alias.h:14