summaryrefslogtreecommitdiff
path: root/llvm/benchmarks
diff options
context:
space:
mode:
authorKirill Bobyrev <kbobyrev.opensource@gmail.com>2018-08-28 09:42:41 +0000
committerKirill Bobyrev <kbobyrev.opensource@gmail.com>2018-08-28 09:42:41 +0000
commit0addd170ab0880941fa4089c2717f3f3a0e4e25a (patch)
tree71d7a249b508800e1be898aa7cb789d4ed7c8f2b /llvm/benchmarks
parent0c4b84e2df541b42238b1e15d2abb5ee4b262402 (diff)
downloadllvm-0addd170ab0880941fa4089c2717f3f3a0e4e25a.tar.gz
Pull google/benchmark library to the LLVM tree
This patch pulls google/benchmark v1.4.1 into the LLVM tree so that any project could use it for benchmark generation. A dummy benchmark is added to `llvm/benchmarks/DummyYAML.cpp` to validate the correctness of the build process. The current version does not utilize LLVM LNT and LLVM CMake infrastructure, but that might be sufficient for most users. Two introduced CMake variables: * `LLVM_INCLUDE_BENCHMARKS` (`ON` by default) generates benchmark targets * `LLVM_BUILD_BENCHMARKS` (`OFF` by default) adds generated benchmark targets to the list of default LLVM targets (i.e. if `ON` benchmarks will be built upon standard build invocation, e.g. `ninja` or `make` with no specific targets) List of modifications: * `BENCHMARK_ENABLE_TESTING` is disabled * `BENCHMARK_ENABLE_EXCEPTIONS` is disabled * `BENCHMARK_ENABLE_INSTALL` is disabled * `BENCHMARK_ENABLE_GTEST_TESTS` is disabled * `BENCHMARK_DOWNLOAD_DEPENDENCIES` is disabled Original discussion can be found here: http://lists.llvm.org/pipermail/llvm-dev/2018-August/125023.html Reviewed by: dberris, lebedev.ri Subscribers: ilya-biryukov, ioeric, EricWF, lebedev.ri, srhines, dschuff, mgorny, krytarowski, fedor.sergeev, mgrang, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D50894 llvm-svn: 340809
Diffstat (limited to 'llvm/benchmarks')
-rw-r--r--llvm/benchmarks/CMakeLists.txt4
-rw-r--r--llvm/benchmarks/DummyYAML.cpp13
2 files changed, 17 insertions, 0 deletions
diff --git a/llvm/benchmarks/CMakeLists.txt b/llvm/benchmarks/CMakeLists.txt
new file mode 100644
index 000000000000..43f88f725792
--- /dev/null
+++ b/llvm/benchmarks/CMakeLists.txt
@@ -0,0 +1,4 @@
+set(LLVM_LINK_COMPONENTS
+ Support)
+
+add_benchmark(DummyYAML DummyYAML.cpp)
diff --git a/llvm/benchmarks/DummyYAML.cpp b/llvm/benchmarks/DummyYAML.cpp
new file mode 100644
index 000000000000..c06b001bb031
--- /dev/null
+++ b/llvm/benchmarks/DummyYAML.cpp
@@ -0,0 +1,13 @@
+#include "benchmark/benchmark.h"
+#include "llvm/Support/YAMLTraits.h"
+
+static void BM_YAMLDummyIsNumeric(benchmark::State& state) {
+ std::string x = "hello";
+ for (auto _ : state) {
+ std::string copy(x);
+ llvm::yaml::isNumeric(copy);
+ }
+}
+BENCHMARK(BM_YAMLDummyIsNumeric);
+
+BENCHMARK_MAIN();