fix: widen per-rule airtime counter

This commit is contained in:
Jason Huebert authored and github-actions[bot] committed 2026-10-14 15:09:36 +00:00
1 parent e0754a74ba
commit 704616f65f
2 files changed
+3 -1

No files matched your search

+1 -1
View File
@@ -146,7 +146,7 @@ struct FilterRule {
// v7: the writer forces it and the reader refuses a v7 record that has it
// set, so a future field can take the byte the way type_mask_hi took 186
uint32_t hits; // match counter (forward/drop telemetry + validation)
uint32_t air_ms; // estimated on-air time (ms) billed by this rule's
uint64_t air_ms; // estimated on-air time (ms) billed by this rule's
// DROP decisions; RAM-only stat, after `hits` so it
// is never persisted (persist ends at offsetof(hits))
// RAM-only throttle state — never persisted (persist ends at offsetof(hits));
@@ -3546,8 +3546,10 @@ TEST_F(FilterTest, AirSavedPercentageUsesWideCounters) {
filter.checkPacket(&adv, 0, nullptr, UINT32_MAX);
EXPECT_EQ(filter.getAirSavedMs(), uint64_t(UINT32_MAX) * 2);
EXPECT_EQ(filter.getAirEvaluatedMs(), uint64_t(UINT32_MAX) * 3);
EXPECT_EQ(filter.getRule(0)->air_ms, uint64_t(UINT32_MAX) * 2);
EXPECT_EQ(filter.getAirSavedPercent(), 67u);
EXPECT_NE(cli(filter, "stats").find("air:8589934s:67%;"), std::string::npos);
EXPECT_NE(cli(filter, "get 0").find("air=8589934s"), std::string::npos);
}
TEST_F(FilterTest, AirSavedPercentageCountsContentOnce) {