diff --git a/src/benchmark/benchmark_ipc_channel.cpp b/src/benchmark/benchmark_ipc_channel.cpp index 86d8fde6e..4232739e1 100644 --- a/src/benchmark/benchmark_ipc_channel.cpp +++ b/src/benchmark/benchmark_ipc_channel.cpp @@ -17,12 +17,10 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "benchmark_setup.h" +#include "catch.h" #include "threading/ipc_channel.h" #include -#include "log.h" - TEST_CASE("benchmark_ipc_channel") { // same as in test_threading.cpp (TODO: remove duplication) @@ -80,13 +78,23 @@ TEST_CASE("benchmark_ipc_channel") } }); - BENCHMARK("simple_call", i) { + BENCHMARK("simple_call_1", i) { char buf[16] = {}; buf[i & 0xf] = i; end_a.exchange(buf, 16); return reinterpret_cast(end_a.getRecvData())[i & 0xf]; }; + BENCHMARK("simple_call_1000", i) { + char buf[16] = {}; + buf[i & 0xf] = i; + for (int k = 0; k < 1000; ++k) { + buf[0] = k & 0xff; + end_a.exchange(buf, 16); + } + return reinterpret_cast(end_a.getRecvData())[i & 0xf]; + }; + // stop thread_b end_a.exchange(nullptr, 0); REQUIRE(end_a.getRecvSize() == 0); diff --git a/src/threading/ipc_channel.cpp b/src/threading/ipc_channel.cpp index 0cb2ce29b..bcd7e6830 100644 --- a/src/threading/ipc_channel.cpp +++ b/src/threading/ipc_channel.cpp @@ -24,10 +24,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "porting.h" #include #include +#include #if defined(IPC_CHANNEL_IMPLEMENTATION_LINUX_FUTEX) #include -#include #include #include #if defined(__i386__) || defined(__x86_64__) diff --git a/src/threading/ipc_channel.h b/src/threading/ipc_channel.h index b26785618..843ff41e9 100644 --- a/src/threading/ipc_channel.h +++ b/src/threading/ipc_channel.h @@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #if defined(_WIN32) #define IPC_CHANNEL_IMPLEMENTATION_WIN32 @@ -37,8 +38,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #if defined(IPC_CHANNEL_IMPLEMENTATION_WIN32) #include -#elif defined(IPC_CHANNEL_IMPLEMENTATION_LINUX_FUTEX) -#include #elif defined(IPC_CHANNEL_IMPLEMENTATION_POSIX) #include #endif