diff --git a/benches/benchmark.sh b/benches/benchmark.sh index 130da81..e234ece 100644 --- a/benches/benchmark.sh +++ b/benches/benchmark.sh @@ -15,11 +15,22 @@ iters=$3 OUTPUT_DIR=benchmark-data.$(date +"%Y.%m.%d.%H-%M-%S") mkdir -p "$OUTPUT_DIR"/fftw3 && mkdir "$OUTPUT_DIR"/rustfft && mkdir "$OUTPUT_DIR"/phastft +benchmark_fftw3() { + make clean && make + + for n in $(seq "$start" "$end"); do + echo "Running FFTW3 benchmark for N = 2^${n}..." && \ + for _ in $(seq 1 "$iters"); do + ./bench_fftw "${n}" >> "${OUTPUT_DIR}"/fftw3/size_"${n}" + done + done +} + benchmark_phastft() { cargo clean && cargo build --release --examples for n in $(seq "$start" "$end"); do - echo "running PhastFT benchmark for N = 2^${n}" && \ + echo "Running PhastFT benchmark for N = 2^${n}..." && \ for _ in $(seq 1 "$iters"); do ../target/release/examples/benchmark "${n}" >> "${OUTPUT_DIR}"/phastft/size_"${n}" done @@ -30,12 +41,13 @@ benchmark_rustfft() { cargo clean && cargo build --release --examples for n in $(seq "$start" "$end"); do - echo "running RustFFT benchmark for N = 2^${n}" && \ + echo "Running RustFFT benchmark for N = 2^${n}..." && \ for _ in $(seq 1 "$iters"); do ../target/release/examples/rustfft "${n}" >> "${OUTPUT_DIR}"/rustfft/size_"${n}" done done } +benchmark_fftw3 +benchmark_phastft benchmark_rustfft -benchmark_phastft \ No newline at end of file diff --git a/benches/main.c b/benches/main.c index a7b96f7..ac97c06 100644 --- a/benches/main.c +++ b/benches/main.c @@ -24,8 +24,8 @@ int main(int argc, char** argv) { fftw_plan p = fftw_plan_dft_1d(N, in, in, FFTW_FORWARD, FFTW_ESTIMATE); fftw_execute(p); double toc = clock(); - double elapsed = ((double)(toc - tic) / CLOCKS_PER_SEC) * 1000000; + printf("%f\n", elapsed); fftw_free(in); fftw_destroy_plan(p);