#ifndef __PERF_H__ #define __PERF_H__ #include #include #if defined linux || __APPLE__ || _WIN32 typedef std::chrono::nanoseconds::rep nano_t; #else typedef uint32_t nano_t; #endif typedef struct { nano_t total; nano_t channel; nano_t voice; nano_t oscillator; nano_t filter; } PerfNanos; extern PerfNanos perfNanos; // Get timestamp in nanoseconds #if defined linux || __APPLE__ || _WIN32 inline nano_t nanos() { return std::chrono::duration_cast( std::chrono::high_resolution_clock::now().time_since_epoch()) .count(); } #else inline nano_t nanos() { // SysTick * 100 / 55 return 0; } #endif #endif