suyu/src/common
Lioncash c51f8563a6
ring_buffer: Use std::hardware_destructive_interference_size to determine alignment size for avoiding false sharing
MSVC 19.11 (A.K.A. VS 15.3)'s C++ standard library implements P0154R1
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0154r1.html)
which defines two new constants within the <new> header, std::hardware_destructive_interference_size
and std::hardware_constructive_interference_size.

std::hardware_destructive_interference_size defines the minimum
recommended offset between two concurrently-accessed objects to avoid
performance degradation due to contention introduced by the
implementation (with the lower-bound being at least alignof(max_align_t)).
In other words, the minimum offset between objects necessary to avoid
false-sharing.

std::hardware_constructive_interference_size on the other hand defines
the maximum recommended size of contiguous memory occupied by two
objects accessed wth temporal locality by concurrent threads (also
defined to be at least alignof(max_align_t)). In other words the maximum
size to promote true-sharing.

So we can simply use this facility to determine the ideal alignment
size. Unfortunately, only MSVC supports this right now, so we need to
enclose it within an ifdef for the time being.
2018-09-18 23:35:57 -04:00
..
logging Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
x64 Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
alignment.h Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
assert.h Port #3474 from Citra 2018-07-07 14:17:44 +02:00
bit_field.h Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
bit_set.h Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
cityhash.cpp Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
cityhash.h Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
CMakeLists.txt common: Implement a ring buffer 2018-09-08 18:56:38 +01:00
color.h common/color: Remove unnecessary const qualifiers on return types 2018-08-08 16:17:41 -04:00
common_funcs.h Port #3732 from Citra: "common: Fix compilation on ARM" 2018-07-29 15:51:31 +02:00
common_paths.h Allow key loading from %YUZU_DIR%/keys in addition to ~/.switch 2018-08-01 00:16:54 -04:00
common_types.h common_types: Convert typedefs to using aliases 2018-04-19 22:26:35 -04:00
file_util.cpp Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
file_util.h Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
hash.h Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
hex_util.cpp Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
hex_util.h Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
math_util.h math_util: Always initialize members of Rectangle 2018-08-02 10:47:34 -04:00
memory_util.cpp Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
memory_util.h Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
microprofile.cpp Integrate the MicroProfile profiling library 2015-08-24 22:16:28 -03:00
microprofile.h Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
microprofileui.h Common: Remove section measurement from profiler (#1731) 2016-04-29 00:07:10 -07:00
misc.cpp Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
param_package.cpp param_package: Take std::string by value in string-based Set() function 2018-07-20 17:24:06 -04:00
param_package.h param_package: Take std::string by value in string-based Set() function 2018-07-20 17:24:06 -04:00
quaternion.h Format: Run the new clang format on everything 2018-01-20 16:45:11 -07:00
ring_buffer.h ring_buffer: Use std::hardware_destructive_interference_size to determine alignment size for avoiding false sharing 2018-09-18 23:35:57 -04:00
scm_rev.cpp.in Better Title Bar Display 2018-09-07 11:54:51 +05:30
scm_rev.h Better Title Bar Display 2018-09-07 11:54:51 +05:30
scope_exit.h Format: Run the new clang format on everything 2018-01-20 16:45:11 -07:00
string_util.cpp Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
string_util.h Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
swap.h Port #3732 from Citra: "common: Fix compilation on ARM" 2018-07-29 15:51:31 +02:00
telemetry.cpp common/telemetry: Migrate core-independent info gathering to common 2018-08-14 18:57:46 -04:00
telemetry.h common/telemetry: Migrate core-independent info gathering to common 2018-08-14 18:57:46 -04:00
thread.cpp Support mingw cross-compile 2016-12-05 19:09:16 +01:00
thread.h Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
thread_queue_list.h thread_queue_list: Make contains() and get_first() const member functions 2018-08-12 12:54:14 -04:00
threadsafe_queue.h remove polymorphism issue 2018-07-29 15:24:41 +02:00
timer.cpp Port #3972 from Citra: "common/timer: use std::chrono, avoid platform-dependent code" 2018-07-29 14:58:30 +02:00
timer.h Port #3972 from Citra: "common/timer: use std::chrono, avoid platform-dependent code" 2018-07-29 14:58:30 +02:00
vector_math.h vector_math: Use variable template version of is_signed in Vec classes 2018-08-08 15:53:42 -04:00