Skip to content
LeviMC
English
AutoLightDark
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/threading/FPSVal.h"
7#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
8#include "mc/platform/brstd/move_only_function.h"
9
10// auto generated forward declare list
11// 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
63 using Clock = ::std::chrono::steady_clock;
64
65 using FPSVal = ::SchedulerDetails::FPSVal;
66
67public:
68 // member variables
69 // NOLINTBEGIN
70 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::Scheduler::CoroutinePolicy>> mCoroutinePolicy;
71 ::ll::TypedStorage<4, 4, uint> mConsideredGoodFrames;
72 ::ll::TypedStorage<4, 4, uint> mObservedGoodFrames;
73 ::ll::TypedStorage<4, 4, uint> mConsideredBadFrames;
74 ::ll::TypedStorage<4, 4, uint> mObservedBadFrames;
75 ::ll::TypedStorage<2, 2, ushort> mIdealNonBoostedFPS;
76 ::ll::TypedStorage<2, 2, ushort> mIdealFPS;
77 ::ll::TypedStorage<2, 2, ushort> mEffectiveTargetFPS;
78 ::ll::TypedStorage<4, 4, uint> mTotalRunCoroutines;
79 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> mTotalCoroutineDuration;
80 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> mPredictedCoroutineDuration;
81 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::WorkerPool>> mCoroutinePool;
82 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mNextStarveCheckTime;
83 ::ll::TypedStorage<4, 4, ::std::thread::id> mThreadID;
84 // NOLINTEND
85
86public:
87 // prevent constructor by default
88 Scheduler();
89
90public:
91 // virtual functions
92 // NOLINTBEGIN
93#ifdef LL_PLAT_S
94 virtual ~Scheduler() /*override*/ = default;
95#else // LL_PLAT_C
96 virtual ~Scheduler() /*override*/;
97#endif
98
99 // NOLINTEND
100
101public:
102 // member functions
103 // NOLINTBEGIN
104 MCNAPI Scheduler(::std::string_view name, ::SchedulerDetails::FPSVal idealFPS);
105
106 MCNAPI void processCoroutines(
107 ::std::chrono::nanoseconds timeSinceSwap,
108 ::Scheduler::MinimumTimeBudget ensureNonZeroRunTime,
109 ::Scheduler::MaximumTimeBudget limitMaxRunTime
110 );
111
112#ifdef LL_PLAT_C
113 MCNAPI ::std::shared_ptr<void> setCoroutinePolicy(::brstd::move_only_function<bool() const> policy);
114#endif
115 // NOLINTEND
116
117public:
118 // constructor thunks
119 // NOLINTBEGIN
120 MCNAPI void* $ctor(::std::string_view name, ::SchedulerDetails::FPSVal idealFPS);
121 // NOLINTEND
122
123public:
124 // destructor thunk
125 // NOLINTBEGIN
126#ifdef LL_PLAT_C
127 MCNAPI void $dtor();
128#endif
129 // NOLINTEND
130
131public:
132 // vftables
133 // NOLINTBEGIN
134 MCNAPI static void** $vftable();
135 // NOLINTEND
136};
Definition EnableNonOwnerReferences.h:7
Definition Scheduler.h:49
static MCAPI void ** $vftable()
MCAPI void * $ctor(::std::string_view name, ::SchedulerDetails::FPSVal idealFPS)
MCAPI Scheduler(::std::string_view name, ::SchedulerDetails::FPSVal idealFPS)
MCAPI void processCoroutines(::std::chrono::nanoseconds timeSinceSwap, ::Scheduler::MinimumTimeBudget ensureNonZeroRunTime, ::Scheduler::MaximumTimeBudget limitMaxRunTime)
Definition WorkerPool.h:22
Definition move_only_function.h:9
Definition Scheduler.h:34
Definition Alias.h:14