mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
some include fixes
This commit is contained in:
parent
22b4f3becf
commit
668d22f39f
3 changed files with 14 additions and 7 deletions
|
@ -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 <thread>
|
||||
|
||||
#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<const u8 *>(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<const u8 *>(end_a.getRecvData())[i & 0xf];
|
||||
};
|
||||
|
||||
// stop thread_b
|
||||
end_a.exchange(nullptr, 0);
|
||||
REQUIRE(end_a.getRecvSize() == 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue