#pragma once #ifndef REAL_BUILD # define REAL_BUILD # include "externals.hh" # include "utilities.hh" # undef REAL_BUILD #endif struct T_ProfilerSamples { float sum; uint32_t nSamples; }; struct T_Profiler { static constexpr uint32_t Samples = 4; static constexpr uint32_t History = 4; static T_Profiler Profiler; void clear( ); void startFrame( ); void start( __rd__ std::string const& section ); void end( __rd__ std::string const& section ); uint32_t sections( ) const noexcept { return sections_.size( ); } std::string const& nameOf( __rd__ const uint32_t section ) const { return sections_[ section ]; } float resultOf( __rd__ const uint32_t section ) const; private: using T_SamplesList_ = std::vector< T_ProfilerSamples >; using T_Data_ = std::vector< T_SamplesList_ >; uint32_t find( __rd__ std::string const& section ) const; std::vector< std::string > sections_; T_Data_ samples_; std::vector< uint64_t > starts_; };