Analog synthesis engine for Klang Modular
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

37 lines
699 B

#ifndef __PERF_H__
#define __PERF_H__
#include <cstdint>
#include <chrono>
#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::nanoseconds>(
std::chrono::high_resolution_clock::now().time_since_epoch())
.count();
}
#else
inline nano_t nanos() {
// SysTick * 100 / 55
return 0;
}
#endif
#endif