summaryrefslogtreecommitdiffstatshomepage
path: root/benchmarks/eminline_noasm.cpp
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-01-29 11:47:40 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2016-01-29 11:47:40 +0100
commit042050ef67a0d320469a6f8ca74bd8684ec4c409 (patch)
tree842576848565813c5f33e21fc06ad058f43a8963 /benchmarks/eminline_noasm.cpp
parent1319453a84718ec50aafdb030eca3bac201995e3 (diff)
Added Google Benchmark library (nw)
Included sample benchmark for eminline for native and noasm Made GoogleTest compile only if tests are compiled
Diffstat (limited to 'benchmarks/eminline_noasm.cpp')
-rw-r--r--benchmarks/eminline_noasm.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/benchmarks/eminline_noasm.cpp b/benchmarks/eminline_noasm.cpp
new file mode 100644
index 00000000000..43c9e36b020
--- /dev/null
+++ b/benchmarks/eminline_noasm.cpp
@@ -0,0 +1,24 @@
+// license:BSD-3-Clause
+// copyright-holders:Miodrag Milanovic
+
+#include "benchmark/benchmark_api.h"
+#include <time.h>
+#include "osdcore.h"
+#include "osdcomm.h"
+#define MAME_NOASM 1
+osd_ticks_t osd_ticks(void)
+{
+ // use the standard library clock function
+ return clock();
+}
+#include "eminline.h"
+
+static void BM_count_leading_zeros_noasm(benchmark::State& state) {
+ UINT32 cnt = 0x332533;
+ while (state.KeepRunning()) {
+ (void)count_leading_zeros(cnt);
+ cnt++;
+ }
+}
+// Register the function as a benchmark
+BENCHMARK(BM_count_leading_zeros_noasm);