Sdk/World: Add profiler
This commit is contained in:
@@ -29,6 +29,7 @@ namespace Ndk
|
||||
|
||||
public:
|
||||
using EntityVector = std::vector<EntityHandle>;
|
||||
struct ProfilerData;
|
||||
|
||||
inline World(bool addDefaultSystems = true);
|
||||
World(const World&) = delete;
|
||||
@@ -46,8 +47,12 @@ namespace Ndk
|
||||
void Clear() noexcept;
|
||||
const EntityHandle& CloneEntity(EntityId id);
|
||||
|
||||
inline void DisableProfiler();
|
||||
inline void EnableProfiler(bool enable = true);
|
||||
|
||||
inline const EntityHandle& GetEntity(EntityId id);
|
||||
inline const EntityList& GetEntities() const;
|
||||
inline const ProfilerData& GetProfilerData() const;
|
||||
inline BaseSystem& GetSystem(SystemIndex index);
|
||||
template<typename SystemType> SystemType& GetSystem();
|
||||
|
||||
@@ -59,18 +64,27 @@ namespace Ndk
|
||||
|
||||
inline bool IsEntityValid(const Entity* entity) const;
|
||||
inline bool IsEntityIdValid(EntityId id) const;
|
||||
inline bool IsProfilerEnabled() const;
|
||||
|
||||
inline void RemoveAllSystems();
|
||||
inline void RemoveSystem(SystemIndex index);
|
||||
template<typename SystemType> void RemoveSystem();
|
||||
|
||||
void Refresh();
|
||||
inline void ResetProfiler();
|
||||
|
||||
void Update(float elapsedTime);
|
||||
|
||||
World& operator=(const World&) = delete;
|
||||
inline World& operator=(World&& world) noexcept;
|
||||
|
||||
struct ProfilerData
|
||||
{
|
||||
Nz::UInt64 refreshTime = 0;
|
||||
std::vector<Nz::UInt64> updateTime;
|
||||
std::size_t updateCount = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
inline void Invalidate();
|
||||
inline void Invalidate(EntityId id);
|
||||
@@ -97,10 +111,12 @@ namespace Ndk
|
||||
std::vector<EntityBlock*> m_entityBlocks;
|
||||
std::vector<std::unique_ptr<EntityBlock>> m_waitingEntities;
|
||||
EntityList m_aliveEntities;
|
||||
ProfilerData m_profilerData;
|
||||
Nz::Bitset<Nz::UInt64> m_dirtyEntities;
|
||||
Nz::Bitset<Nz::UInt64> m_freeEntityIds;
|
||||
Nz::Bitset<Nz::UInt64> m_killedEntities;
|
||||
bool m_orderedSystemsUpdated;
|
||||
bool m_isProfilerEnabled;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user