aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/testing/benchmark/bench.h
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/testing/benchmark/bench.h
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/testing/benchmark/bench.h')
-rw-r--r--library/cpp/testing/benchmark/bench.h72
1 files changed, 36 insertions, 36 deletions
diff --git a/library/cpp/testing/benchmark/bench.h b/library/cpp/testing/benchmark/bench.h
index 6f7a9f3f44..21551ad0dd 100644
--- a/library/cpp/testing/benchmark/bench.h
+++ b/library/cpp/testing/benchmark/bench.h
@@ -1,29 +1,29 @@
-#pragma once
-
+#pragma once
+
#include <util/system/compiler.h>
-#include <util/system/types.h>
-
+#include <util/system/types.h>
+
#include <utility>
-namespace NBench {
- namespace NCpu {
- struct TParams {
- inline size_t Iterations() const noexcept {
- return Iterations_;
- }
-
- const size_t Iterations_;
- };
-
- using TUserFunc = void(TParams&);
-
- struct TRegistar {
- TRegistar(const char* name, TUserFunc func);
-
- char Buf[128];
- };
- }
-
+namespace NBench {
+ namespace NCpu {
+ struct TParams {
+ inline size_t Iterations() const noexcept {
+ return Iterations_;
+ }
+
+ const size_t Iterations_;
+ };
+
+ using TUserFunc = void(TParams&);
+
+ struct TRegistar {
+ TRegistar(const char* name, TUserFunc func);
+
+ char Buf[128];
+ };
+ }
+
/**
* Functions that states "I can read and write everywhere in memory".
*
@@ -42,10 +42,10 @@ namespace NBench {
#if defined(__GNUC__)
Y_FORCE_INLINE void Clobber() {
- asm volatile(""
- :
- :
- : "memory");
+ asm volatile(""
+ :
+ :
+ : "memory");
}
#elif defined(_MSC_VER)
Y_FORCE_INLINE void Clobber() {
@@ -60,10 +60,10 @@ namespace NBench {
#if defined(__GNUC__)
template <typename T>
Y_FORCE_INLINE void Escape(T* p) {
- asm volatile(""
- :
- : "g"(p)
- : "memory");
+ asm volatile(""
+ :
+ : "g"(p)
+ : "memory");
}
#else
template <typename T>
@@ -77,16 +77,16 @@ namespace NBench {
* @param Unused variable (e.g. return value of benchmarked function).
*/
template <typename T>
- Y_FORCE_INLINE void DoNotOptimize(T&& datum) {
+ Y_FORCE_INLINE void DoNotOptimize(T&& datum) {
::DoNotOptimizeAway(std::forward<T>(datum));
- }
+ }
int Main(int argc, char** argv);
-}
-
+}
+
#define Y_CPU_BENCHMARK(name, cnt) \
namespace N_bench_##name { \
static void Run(::NBench::NCpu::TParams&); \
const ::NBench::NCpu::TRegistar benchmark(#name, &Run); \
} \
- static void N_bench_##name::Run(::NBench::NCpu::TParams& cnt)
+ static void N_bench_##name::Run(::NBench::NCpu::TParams& cnt)