Log sampled BBR model state without flooding transport diagnostics
This commit is contained in:
1 parent
f8d532b04d
commit
0364abb00e
2 files changed
+26
-1
No files matched your search
+1
-1
@@ -1029,7 +1029,7 @@ test_dummynet_channels_LDADD = $(LIBUTUN) $(COMMON_LIBS)
|
||||
test_dummynet_channels_LDFLAGS = $(test_clock_ldflags)
|
||||
test_etcp_multipath_SOURCES = test_etcp_multipath.c $(test_clock_sources)
|
||||
test_etcp_multipath_LDADD = $(LIBUTUN) $(COMMON_LIBS)
|
||||
test_etcp_multipath_LDFLAGS = $(test_clock_ldflags) -Wl,--wrap=etcp_dump_pkt_sections
|
||||
test_etcp_multipath_LDFLAGS = $(test_clock_ldflags) -Wl,--wrap=etcp_dump_pkt_sections -Wl,--wrap=bbr_main
|
||||
test_stcp_sigpipe_SOURCES = test_stcp_sigpipe.c
|
||||
test_stcp_sigpipe_LDADD = $(LIBUTUN) $(COMMON_LIBS)
|
||||
test_etcp_windows_LDADD = $(LIBUTUN) $(COMMON_LIBS)
|
||||
|
||||
@@ -43,6 +43,8 @@ static unsigned path_count, failures, enabled_mask, bidirectional, low_load, mea
|
||||
static uint64_t started, next_message[2], measure_start, fault_start;
|
||||
static uint32_t fault_seq;
|
||||
static unsigned fault_trace_count;
|
||||
static int log_bbr_samples;
|
||||
static uint64_t sample_logged[2][PATHS];
|
||||
static FILE* csv;
|
||||
static const char* case_name;
|
||||
static const char* pubkeys[2] = {
|
||||
@@ -54,6 +56,27 @@ static const char* privkeys[2] = {
|
||||
"38240cb82199e504686507f11f6eaa4f740fde6f0c425c495e49a523019a5d68"
|
||||
};
|
||||
|
||||
/* Выборочная диагностика модели: один sample на линк/100мс, без packet-level спама всего ETCP. */
|
||||
void __real_bbr_main(struct bbr*, const struct bbr_rate_sample*, uint32_t*, uint32_t*, uint32_t, uint32_t, int);
|
||||
void __wrap_bbr_main(struct bbr* model, const struct bbr_rate_sample* sample, uint32_t* cwnd, uint32_t* pacing,
|
||||
uint32_t mss, uint32_t inflight, int limited) {
|
||||
__real_bbr_main(model, sample, cwnd, pacing, mss, inflight, limited);
|
||||
if (!log_bbr_samples) return;
|
||||
uint64_t now = get_time_us();
|
||||
for (int side = 0; side < 2; side++) for (struct ETCP_LINK* l = ep[side].conn ? ep[side].conn->links : NULL; l; l = l->next) {
|
||||
if (l->bbr != model) continue;
|
||||
for (unsigned p = 0; p < path_count; p++) {
|
||||
if (ss_get_port(&l->remote_addr) != dummynet_get_listen_port(channels[p]) || now < sample_logged[side][p] + 100000) continue;
|
||||
sample_logged[side][p] = now;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "BBR %s mask=%x side=%d path=%u mode=%u cycle=%u sample=%u/%uus rtt=%u "
|
||||
"min_rtt=%u inflight=%u cwnd=%u pace=%u hi=%u lo=%u app=%d limited=%d", case_name, enabled_mask,
|
||||
side, p, model->mode, model->cycle_idx, sample->delivered, sample->interval_us, sample->rtt_us,
|
||||
model->min_rtt_us, inflight, *cwnd, *pacing, model->inflight_hi, model->inflight_lo,
|
||||
sample->is_app_limited, limited);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Наблюдение не заменяет передачу/приём и не меняет состояние протокола. */
|
||||
void __real_etcp_dump_pkt_sections(struct ETCP_DGRAM*, struct ETCP_LINK*, int);
|
||||
void __wrap_etcp_dump_pkt_sections(struct ETCP_DGRAM* pkt, struct ETCP_LINK* link, int sending) {
|
||||
@@ -137,6 +160,7 @@ static void setup(const struct profile* settings, unsigned count, unsigned mask)
|
||||
memset(ep, 0, sizeof(ep)); memset(channels, 0, sizeof(channels));
|
||||
memset(traces, 0, sizeof(traces)); memset(traffic, 0, sizeof(traffic));
|
||||
memset(next_message, 0, sizeof(next_message));
|
||||
memset(sample_logged, 0, sizeof(sample_logged));
|
||||
path_count = count; enabled_mask = mask; measuring = 0; fault_start = 0; fault_trace_count = 0;
|
||||
memcpy(profiles, settings, count * sizeof(*settings));
|
||||
ua = uasync_create(); CHECK(ua);
|
||||
@@ -393,6 +417,7 @@ static void stalled(const struct profile* settings, unsigned count, unsigned bro
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
debug_config_init(); debug_set_level(DEBUG_LEVEL_ERROR); test_clock_init(10);
|
||||
log_bbr_samples = getenv("UTUN_BBR_SAMPLES") != NULL;
|
||||
if (getenv("UTUN_TEST_DEBUG")) debug_set_category_level(DEBUG_CATEGORY_ETCP, DEBUG_LEVEL_DEBUG);
|
||||
CHECK(socket_platform_init() == 0);
|
||||
const char* output = getenv("UTUN_MULTIPATH_CSV");
|
||||
|
||||
Reference in new issue
Block a user