Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change flows_per_sec to flows in tc module #8237

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions below/dump/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ fn test_tc_titles() {
"qdisc.fq_codel.ce_threshold",
"qdisc.fq_codel.drop_batch_size",
"qdisc.fq_codel.memory_limit",
"qdisc.fq_codel.flows_per_sec",
"qdisc.fq_codel.flows",
];
assert_eq!(titles, expected_titles);
}
Expand Down Expand Up @@ -1315,7 +1315,7 @@ fn test_dump_tc_content() {
ce_threshold: 101,
drop_batch_size: 9000,
memory_limit: 123456,
flows_per_sec: Some(31415),
flows: 1024,
}),
}),
xstats: Some(model::XStatsModel {
Expand Down Expand Up @@ -1424,7 +1424,7 @@ fn test_dump_tc_content() {
"CeThreshold": "101",
"DropBatchSize": "9000",
"MemoryLimit": "123456",
"Flows": "31415/s",
"Flows": "1024",
"MaxPacket": "8675309",
"EcnMark": "299792458",
"NewFlowsLen": "314",
Expand Down
2 changes: 1 addition & 1 deletion below/model/src/common_field_ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ pub const COMMON_MODEL_FIELD_IDS: [&str; 478] = [
"tc.tc.<idx>.qdisc.fq_codel.ce_threshold",
"tc.tc.<idx>.qdisc.fq_codel.drop_batch_size",
"tc.tc.<idx>.qdisc.fq_codel.ecn",
"tc.tc.<idx>.qdisc.fq_codel.flows_per_sec",
"tc.tc.<idx>.qdisc.fq_codel.flows",
"tc.tc.<idx>.qdisc.fq_codel.interval",
"tc.tc.<idx>.qdisc.fq_codel.limit",
"tc.tc.<idx>.qdisc.fq_codel.memory_limit",
Expand Down
2 changes: 1 addition & 1 deletion below/model/src/sample_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ pub const SAMPLE_MODEL_JSON: &str = r#"
"ce_threshold": 101,
"drop_batch_size": 9000,
"memory_limit": 123456,
"flows_per_sec": 31415
"flows": 1024
}
},
"xstats": {
Expand Down
26 changes: 6 additions & 20 deletions below/model/src/tc_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ impl SingleTcModel {
}

if let Some(sample) = sample.qdisc.as_ref() {
let last = last.and_then(|(last, d)| last.qdisc.as_ref().map(|l| (l, d)));

tc_model.qdisc = Some(QDiscModel::new(sample, last));
tc_model.qdisc = Some(QDiscModel::new(sample));
}

tc_model
Expand All @@ -123,17 +121,10 @@ pub struct QDiscModel {
}

impl QDiscModel {
fn new(sample: &QDisc, last: Option<(&QDisc, Duration)>) -> Self {
fn new(sample: &QDisc) -> Self {
match sample {
QDisc::FqCodel(sample) => Self {
fq_codel: {
last.map(|(l, d)| match l {
QDisc::FqCodel(last) => {
let last = Some((last, d));
FqCodelQDiscModel::new(sample, last)
}
})
},
fq_codel: Some(FqCodelQDiscModel::new(sample)),
},
}
}
Expand All @@ -149,11 +140,11 @@ pub struct FqCodelQDiscModel {
pub ce_threshold: u32,
pub drop_batch_size: u32,
pub memory_limit: u32,
pub flows_per_sec: Option<u32>,
pub flows: u32,
}

impl FqCodelQDiscModel {
fn new(sample: &tc::FqCodelQDisc, last: Option<(&tc::FqCodelQDisc, Duration)>) -> Self {
fn new(sample: &tc::FqCodelQDisc) -> Self {
Self {
target: sample.target,
limit: sample.limit,
Expand All @@ -163,12 +154,7 @@ impl FqCodelQDiscModel {
ce_threshold: sample.ce_threshold,
drop_batch_size: sample.drop_batch_size,
memory_limit: sample.memory_limit,
flows_per_sec: {
last.and_then(|l| {
let last = Some(l);
rate!(flows, sample, last, u32)
})
},
flows: sample.flows,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions below/render/src/default_configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,7 @@ impl HasRenderConfig for model::FqCodelQDiscModel {
CeThreshold => rc.title("CeThreshold"),
DropBatchSize => rc.title("DropBatchSize"),
MemoryLimit => rc.title("MemoryLimit"),
FlowsPerSec => rc.title("Flows").suffix("/s"),
Flows => rc.title("Flows"),
}
}
}
Expand Down Expand Up @@ -1793,7 +1793,7 @@ impl HasRenderConfigForDump for model::FqCodelQDiscModel {
CeThreshold => Some(gauge()),
DropBatchSize => Some(gauge()),
MemoryLimit => Some(gauge()),
FlowsPerSec => Some(gauge()),
Flows => Some(gauge()),
}
}
}
Expand Down
Loading