summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Ilvokhin <d@ilvokhin.com>2025-07-19 19:38:35 +0100
committerDmitry Ilvokhin <d@ilvokhin.com>2025-07-19 19:38:35 +0100
commitd32eed68de5ea17abc41cdbc90e4ef90ca0c7c4a (patch)
tree82f56c0a3bf16210616bf80973a589c02503cef8
parente4db7f9c006927fa4b96bcedaefa3338fed931c1 (diff)
downloadinfra-d32eed68de5ea17abc41cdbc90e4ef90ca0c7c4a.tar.gz
infra-d32eed68de5ea17abc41cdbc90e4ef90ca0c7c4a.tar.bz2
infra-d32eed68de5ea17abc41cdbc90e4ef90ca0c7c4a.zip
Add template for C++ benchmarks
-rw-r--r--misc/dotfiles/templates/benchmark.cpp17
-rw-r--r--roles/dotfiles/tasks/main.yml6
2 files changed, 23 insertions, 0 deletions
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 <benchmark/benchmark.h>
+
+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