From d32eed68de5ea17abc41cdbc90e4ef90ca0c7c4a Mon Sep 17 00:00:00 2001 From: Dmitry Ilvokhin Date: Sat, 19 Jul 2025 19:38:35 +0100 Subject: Add template for C++ benchmarks --- misc/dotfiles/templates/benchmark.cpp | 17 +++++++++++++++++ roles/dotfiles/tasks/main.yml | 6 ++++++ 2 files changed, 23 insertions(+) create mode 100644 misc/dotfiles/templates/benchmark.cpp diff --git a/misc/dotfiles/templates/benchmark.cpp b/misc/dotfiles/templates/benchmark.cpp new file mode 100644 index 0000000..ff0519b --- /dev/null +++ b/misc/dotfiles/templates/benchmark.cpp @@ -0,0 +1,17 @@ +#include + +static void BM_Baseline(benchmark::State& state) { + for (auto _ : state) { + __asm__("nop"); + } +} +BENCHMARK(BM_Baseline); + +static void BM_Treatment(benchmark::State& state) { + for (auto _ : state) { + __asm__("nop"); + } +} +BENCHMARK(BM_Treatment); + +BENCHMARK_MAIN(); diff --git a/roles/dotfiles/tasks/main.yml b/roles/dotfiles/tasks/main.yml index 4def4d4..ba707a1 100644 --- a/roles/dotfiles/tasks/main.yml +++ b/roles/dotfiles/tasks/main.yml @@ -197,6 +197,12 @@ dest: '{{ homedir }}/.templates/template.cpp' when: has_cpp.rc == 0 + - name: Copy benchmark.cpp to home directory + ansible.builtin.copy: + src: misc/dotfiles/templates/benchmark.cpp + dest: '{{ homedir }}/.templates/benchmark.cpp' + when: has_cpp.rc == 0 + - name: Copy template.py to home directory ansible.builtin.copy: src: misc/dotfiles/templates/template.py -- cgit v1.2.3-70-g09d2