7#ifndef NO_MULTITHREADING
19 std::vector<uint8_t>
data(1024);
22 std::for_each(
data.begin(),
data.end(), [](
auto& i) { i = i & 0x80; });
23 std::for_each(
data.begin(),
data.end(), [](
auto& i) { i = i | 0x01; });
24 std::for_each(
data.begin(),
data.end(), [](
auto& i) { i = static_cast<uint8_t>(i << 3); });
32 info(
"thread_test_abort aborting");
38 info(
"test starting...");
40 size_t NUM_THREADS = ntohl(*thread_num);
41 std::vector<std::thread> threads(NUM_THREADS);
43 test_data.
iterations = ntohl(*iterations) / NUM_THREADS;
45 for (
size_t i = 0; i < NUM_THREADS; i++) {
50 for (
size_t i = 0; i < NUM_THREADS; i++) {
54 info(
"test complete with counter at: ",
static_cast<size_t>(test_data.
counter),
" ", t.
seconds(),
"s");
55 *out = htonl(test_data.
counter);
66 info(
"test_abort aborting");
76 static_cast<void>(fprintf(stdout,
"c: hello stdout!"));
77 static_cast<void>(fflush(stdout));
78 static_cast<void>(fprintf(stderr,
"c: hello stderr!"));
Get the execution between a block of code.
double seconds() const
Return the number of seconds elapsed since the start of the timer.
void thread_test_abort_entry_point(void *)
WASM_EXPORT void test_threads(uint32_t const *thread_num, uint32_t const *iterations, uint32_t *out)
WASM_EXPORT void test_stdout_stderr()
void thread_test_entry_point(test_threads_data *v)
WASM_EXPORT void test_thread_abort()
WASM_EXPORT void test_abort()
const std::vector< MemoryValue > data
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::atomic< uint32_t > counter