File tree Expand file tree Collapse file tree 4 files changed +44
-5
lines changed Expand file tree Collapse file tree 4 files changed +44
-5
lines changed Original file line number Diff line number Diff line change
1
+ if (YDB_SDK_TESTS )
2
+ add_subdirectory (benchmark )
3
+ endif ()
4
+
1
5
add_subdirectory (grpc/client )
2
6
add_subdirectory (json_value )
3
7
add_subdirectory (jwt )
Original file line number Diff line number Diff line change
1
+ _ydb_sdk_add_library (benchmark-clobber INTERFACE )
Original file line number Diff line number Diff line change
1
+ #pragma once
2
+
3
+ #include < util/system/compiler.h>
4
+
5
+ namespace NBench {
6
+
7
+ /* *
8
+ * Functions that states "I can read and write everywhere in memory".
9
+ *
10
+ * Use it to prevent optimizer from reordering or discarding memory writes prior
11
+ * to it's call, and force memory reads after it's call.
12
+ */
13
+ Y_FORCE_INLINE void Clobber () {
14
+ #if defined(__GNUC__)
15
+ asm volatile (" "
16
+ :
17
+ :
18
+ : " memory" );
19
+ #elif defined(_MSC_VER)
20
+ _ReadWriteBarrier ();
21
+ #else
22
+ // Otherwise, do nothing
23
+ #endif
24
+ }
25
+
26
+ } // namespace NBench
Original file line number Diff line number Diff line change @@ -310,12 +310,7 @@ if (YDB_SDK_TESTS)
310
310
system /thread_ut.cpp
311
311
312
312
system /types_ut.cpp
313
-
314
- # TODO: add library/cpp/testing/benchmark
315
- # depends only on NBench::Clobber, that's a memory optimization barrier
316
- # system/unaligned_mem_ut.cpp
317
313
system /user_ut.cpp
318
-
319
314
system /yassert_ut.cpp
320
315
LINK_LIBRARIES
321
316
yutil
@@ -324,6 +319,19 @@ if (YDB_SDK_TESTS)
324
319
unit
325
320
)
326
321
322
+ add_ydb_test (NAME util-system-unaligned_mem_ut
323
+ WORKING_DIRECTORY
324
+ ${CMAKE_CURRENT_BINARY_DIR} /system
325
+ SOURCES
326
+ system /unaligned_mem_ut.cpp
327
+ LINK_LIBRARIES
328
+ yutil
329
+ benchmark-clobber
330
+ cpp-testing-unittest_main
331
+ LABELS
332
+ unit
333
+ )
334
+
327
335
add_ydb_test (NAME util-system-fstat_ut
328
336
WORKING_DIRECTORY
329
337
${CMAKE_CURRENT_BINARY_DIR} /system
You can’t perform that action at this time.
0 commit comments