yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f65d756bf
master
1#ifndef PLATFORM_PERFORMANCE_COUNTER_H 2#define PLATFORM_PERFORMANCE_COUNTER_H 3 4#include <chrono> 5 6namespace platform 7{ 8typedef std ::chrono ::high_resolution_clock ::time_point TimePoint ; 9typedef std ::chrono ::high_resolution_clock ::duration Duration ; 10 11class PerformanceCounter 12{ 13public : 14static inline TimePoint now () {return std ::chrono ::high_resolution_clock ::now (); } 15static inline Duration getElapsedTime (TimePoint counter ) {return now ()- counter ; } 16static inline float getElapsedTimeInSeconds (TimePoint counter ) 17 { 18return (float )toSeconds (now ()- counter ); 19 } 20static inline double toSeconds (Duration duration ) 21 { 22return std ::chrono ::duration < float > (duration ).count (); 23 } 24}; 25}// namespace platform 26 27#endif