diff options
| author | eunhhu <[email protected]> | 2026-10-01 08:52:43 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-01 08:52:43 +0100 |
| commit | 94e7bb87bce6821e91734f1fcbb6cfd61a008049 (patch) | |
| tree | 6eb3f11da43583a3a3e4a13e360005ab5340920f /research/experiments/019-idle-links/transport.c | |
| parent | 99b221927c6feb595b7758ae9bf8370054028fae (diff) | |
| download | pure-94e7bb87bce6821e91734f1fcbb6cfd61a008049.tar.gz pure-94e7bb87bce6821e91734f1fcbb6cfd61a008049.zip | |
Push a turn's sends to a link at once, and round only the links that want one (017, 2b-1)
The sending loop was woken by every record queued while it slept: the
owner queues one by one, the loop caught up and slept between them, and
every link took a round on every wake. Four links sent 64k packets of
12 records where threads sent 40k of 20, and ran at 257k sends/s
against 581k. The owner now queues a turn's sends and pushes each link
once; the loop rounds a link only when its socket has answers, it was
pushed, or its time came.
Diffstat (limited to 'research/experiments/019-idle-links/transport.c')
| -rw-r--r-- | research/experiments/019-idle-links/transport.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/research/experiments/019-idle-links/transport.c b/research/experiments/019-idle-links/transport.c index 3a531ef..4560850 100644 --- a/research/experiments/019-idle-links/transport.c +++ b/research/experiments/019-idle-links/transport.c @@ -191,6 +191,7 @@ int main(int argc, char **argv) { if (!window) /* a backlog: all queued before the link starts */ for (; first <= count; ++first) if (!pure_link_queue(link, first, payload, payload_size)) return fputs("transport: cannot queue\n", stderr), 1; + if (!window) pure_link_push(link); began = now_ns(); uint64_t cpu_link = 0, cpu_listen = thread_cpu("pure-listen"), cpu_all = thread_cpu(NULL); uint64_t end = limit > 0 ? began + (uint64_t)(limit * 1e9) : UINT64_MAX; @@ -204,13 +205,14 @@ int main(int argc, char **argv) { if (now_ns() >= end) break; if (queued_at) queued_at[seq] = now_ns(); if (!pure_link_queue(link, seq, payload, payload_size)) return fputs("transport: cannot queue\n", stderr), 1; + pure_link_push(link); } while (pure_link_delivered(link) < count && now_ns() < end) { struct timespec pause = {0, 50000}; nanosleep(&pause, NULL); } double seconds = (double)((end < now_ns() ? end : now_ns()) - began) / 1e9; - uint64_t link_ns = thread_cpu("pure-link") - cpu_link, listen_ns = thread_cpu("pure-listen") - cpu_listen, + uint64_t link_ns = thread_cpu("pure-send") - cpu_link, listen_ns = thread_cpu("pure-listen") - cpu_listen, all_ns = thread_cpu(NULL) - cpu_all; PureLinkCounts sent, got; pure_link_counts(link, &sent); |
