// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #pragma once #if COMPILE_WITH_PROFILER #include "Engine/Core/Collections/Dictionary.h" #include "Engine/Platform/MemoryStats.h" #include "Engine/Scripting/ScriptingType.h" #include "Engine/Profiler/Profiler.h" /// /// Profiler tools for development. Allows to gather profiling data and events from the engine. /// API_CLASS(Static) class FLAXENGINE_API ProfilingTools { DECLARE_SCRIPTING_TYPE_NO_SPAWN(ProfilingTools); public: /// /// The GPU memory stats. /// API_STRUCT(NoDefault) struct MemoryStatsGPU { DECLARE_SCRIPTING_TYPE_MINIMAL(MemoryStatsGPU); /// /// The total amount of memory in bytes (as reported by the driver). /// API_FIELD() uint64 Total; /// /// The used by the game amount of memory in bytes (estimated). /// API_FIELD() uint64 Used; }; /// /// Engine profiling data header. Contains main info and stats. /// API_STRUCT(NoDefault) struct MainStats { DECLARE_SCRIPTING_TYPE_MINIMAL(MainStats); /// /// The process memory stats. /// API_FIELD() ProcessMemoryStats ProcessMemory; /// /// The CPU memory stats. /// API_FIELD() MemoryStats MemoryCPU; /// /// The GPU memory stats. /// API_FIELD() MemoryStatsGPU MemoryGPU; /// /// The frames per second (fps counter). /// API_FIELD() int32 FPS; /// /// The update time on CPU (in milliseconds). /// API_FIELD() float UpdateTimeMs; /// /// The fixed update time on CPU (in milliseconds). /// API_FIELD() float PhysicsTimeMs; /// /// The draw time on CPU (in milliseconds). /// API_FIELD() float DrawCPUTimeMs; /// /// The draw time on GPU (in milliseconds). /// API_FIELD() float DrawGPUTimeMs; /// /// The last rendered frame stats. /// API_FIELD() RenderStatsData DrawStats; }; /// /// The CPU thread stats. /// API_STRUCT(NoDefault) struct ThreadStats { DECLARE_SCRIPTING_TYPE_MINIMAL(ThreadStats); /// /// The thread name. /// API_FIELD() String Name; /// /// The events list. /// API_FIELD() Array Events; }; public: /// /// The current collected main stats by the profiler from the local session. Updated every frame. /// API_FIELD(ReadOnly) static MainStats Stats; /// /// The CPU threads profiler events. /// API_FIELD(ReadOnly) static Array> EventsCPU; /// /// The GPU rendering profiler events. /// API_FIELD(ReadOnly) static Array EventsGPU; }; #endif