diff options
| author | levlam <levlam@telegram.org> | 2021-10-25 01:46:39 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2021-10-25 01:46:39 +0300 |
| commit | f7d073baa40fb72a7aa3fd2549ac3d7b7e0cdd10 (patch) | |
| tree | b14b854481202e3b5310ecfe7030c10d5204345e /benchmark | |
| parent | 2431afc72213ca73e1382092341a6e970479ee4a (diff) | |
Fix building with TD_EVENTFD_UNSUPPORTED.
Diffstat (limited to 'benchmark')
| -rw-r--r-- | benchmark/bench_queue.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/benchmark/bench_queue.cpp b/benchmark/bench_queue.cpp index f9a724fd3..8f1883acd 100644 --- a/benchmark/bench_queue.cpp +++ b/benchmark/bench_queue.cpp @@ -34,14 +34,12 @@ #define MODE std::memory_order_relaxed // void set_affinity(int mask) { -// int err, syscallres; -// pid_t pid = gettid(); -// syscallres = syscall(__NR_sched_setaffinity, pid, sizeof(mask), &mask); -// if (syscallres) { -// err = errno; -// perror("oppa"); -//} -//} +// pid_t pid = gettid(); +// int syscallres = syscall(__NR_sched_setaffinity, pid, sizeof(mask), &mask); +// if (syscallres) { +// perror("Failed to set affinity"); +// } +// } using qvalue_t = int; @@ -901,7 +899,8 @@ class RingBenchmark final : public td::Benchmark { } }; -void test_queue() { +#if !TD_THREAD_UNSUPPORTED && !TD_EVENTFD_UNSUPPORTED +static void test_queue() { std::vector<td::thread> threads; static constexpr size_t THREAD_COUNT = 100; std::vector<td::MpscPollableQueue<int>> queues(THREAD_COUNT); @@ -927,10 +926,13 @@ void test_queue() { } } } +#endif int main() { SET_VERBOSITY_LEVEL(VERBOSITY_NAME(DEBUG)); - //test_queue(); +#if !TD_THREAD_UNSUPPORTED && !TD_EVENTFD_UNSUPPORTED + // test_queue(); +#endif #define BENCH_Q2(Q, N) \ std::fprintf(stderr, "!%s %d:\t", #Q, N); \ td::bench(QueueBenchmark2<Q>(N)); @@ -945,12 +947,14 @@ int main() { // BENCH_R(SemQueue); // BENCH_R(td::PollQueue<qvalue_t>); +#if !TD_THREAD_UNSUPPORTED && !TD_EVENTFD_UNSUPPORTED BENCH_Q2(td::PollQueue<qvalue_t>, 1); BENCH_Q2(td::MpscPollableQueue<qvalue_t>, 1); BENCH_Q2(td::PollQueue<qvalue_t>, 100); BENCH_Q2(td::MpscPollableQueue<qvalue_t>, 100); BENCH_Q2(td::PollQueue<qvalue_t>, 10); BENCH_Q2(td::MpscPollableQueue<qvalue_t>, 10); +#endif BENCH_Q(VarQueue, 1); // BENCH_Q(FdQueue, 1); @@ -959,12 +963,15 @@ int main() { BENCH_Q(SemCheatQueue, 1); BENCH_Q(SemQueue, 1); +#if !TD_THREAD_UNSUPPORTED && !TD_EVENTFD_UNSUPPORTED // BENCH_Q2(td::PollQueue<qvalue_t>, 100); // BENCH_Q2(td::PollQueue<qvalue_t>, 10); // BENCH_Q2(td::PollQueue<qvalue_t>, 4); // BENCH_Q2(td::InfBackoffQueue<qvalue_t>, 100); // BENCH_Q2(td::InfBackoffQueue<qvalue_t>, 1); +#endif + // BENCH_Q(SemCheatQueue, 1); // BENCH_Q(BufferedFdQueue, 100); |
