noise_benchmark.cpp (720B)
1 2 #include <benchmark/benchmark.h> 3 4 #include "dsp/noise.hpp" 5 6 using namespace bogaudio::dsp; 7 8 static void BM_Noise_WhiteNoise(benchmark::State& state) { 9 WhiteNoiseGenerator g; 10 for (auto _ : state) { 11 g.next(); 12 } 13 } 14 BENCHMARK(BM_Noise_WhiteNoise); 15 16 static void BM_Noise_PinkNoise(benchmark::State& state) { 17 PinkNoiseGenerator g; 18 for (auto _ : state) { 19 g.next(); 20 } 21 } 22 BENCHMARK(BM_Noise_PinkNoise); 23 24 static void BM_Noise_RedNoise(benchmark::State& state) { 25 RedNoiseGenerator g; 26 for (auto _ : state) { 27 g.next(); 28 } 29 } 30 BENCHMARK(BM_Noise_RedNoise); 31 32 static void BM_Noise_GaussianNoise(benchmark::State& state) { 33 GaussianNoiseGenerator g; 34 for (auto _ : state) { 35 g.next(); 36 } 37 } 38 BENCHMARK(BM_Noise_GaussianNoise);