/* pipeline.h - adaptive request window based on observed bandwidth-delay product. */ #ifndef NAUT_PIPELINE_H #define NAUT_PIPELINE_H #include "naut/common.h" typedef struct { double rtt_seconds; double bytes_per_second; double last_sample_at; uint32_t depth; uint32_t min_depth; uint32_t max_depth; uint32_t block_size; } naut_pipeline; void naut_pipeline_init(naut_pipeline *p, uint32_t block_size, uint32_t min_depth, uint32_t max_depth, uint32_t initial_depth); /* Record one completed request. sent_at and received_at are monotonic seconds. * The controller smooths RTT and delivery rate, then targets 2x BDP to absorb * scheduling jitter without allowing an unbounded request window. */ void naut_pipeline_on_block(naut_pipeline *p, uint32_t bytes, double sent_at, double received_at); uint32_t naut_pipeline_depth(const naut_pipeline *p); #endif /* NAUT_PIPELINE_H */