Skip to content

Commit 0b54d7f

Browse files
committed
Restructure beman benchmark with bridges, statistics, and rigor
- Restructure beman benchmark into 3 tables x 3 stream types - Add awaitable/sender bridge columns to benchmark - Replace callback pipeline runners with repeat_effect_until - Normalize coroutine function names - Improve measurement precision and remove unused parameters - Generalize bridge implementations and improve benchmark rigor - Make awaitable_sender fully general: define get_io_executor query CPO, extract executor from P2300 scheduler via standard forwarding queries, remove all benchmark-specific types from bridge code - Make sender_awaitable universally safe: atomic exchange protocol handles synchronous completion during start() without UB - Add as_awaitable member to awaitable_sender so beman's await_transform bypasses sender_awaitable wrapping - Make sender_thread_pool inherit execution_context, eliminating separate bench_context and null pointer in executor adapter - Add multi-run statistics (5 runs, mean +/- stddev) - Replace magic numbers with named constants - Fix row labels to show abstraction level, not stream type - Reorder tables: sender/receiver pipeline first
1 parent 83cdfcd commit 0b54d7f

21 files changed

+2028
-652
lines changed

bench/beman/allocation_tracker.hpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// Copyright (c) 2026 Steve Gerbino
3+
//
4+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
5+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6+
//
7+
// Official repository: https://github.com/cppalliance/capy
8+
//
9+
10+
#ifndef BOOST_CAPY_BENCH_ALLOCATION_TRACKER_HPP
11+
#define BOOST_CAPY_BENCH_ALLOCATION_TRACKER_HPP
12+
13+
#include <atomic>
14+
#include <cstddef>
15+
#include <cstdlib>
16+
#include <new>
17+
18+
static std::atomic<int64_t> g_alloc_count{0};
19+
20+
void* operator new(std::size_t n)
21+
{
22+
g_alloc_count.fetch_add(1, std::memory_order_relaxed);
23+
void* p = std::malloc(n);
24+
if (!p)
25+
throw std::bad_alloc();
26+
return p;
27+
}
28+
29+
void operator delete(void* p) noexcept
30+
{
31+
std::free(p);
32+
}
33+
34+
void operator delete(void* p, std::size_t) noexcept
35+
{
36+
std::free(p);
37+
}
38+
39+
#endif

0 commit comments

Comments
 (0)