mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2024-11-28 10:53:48 -06:00
Remove per-tick printing
Cap number of watched queues at (CPU cores * 2), per belyivulk
This commit is contained in:
parent
7ea5ab3cd8
commit
f9351757ca
1
src/rust/Cargo.lock
generated
1
src/rust/Cargo.lock
generated
@ -1330,6 +1330,7 @@ dependencies = [
|
||||
"log",
|
||||
"lqos_bus",
|
||||
"lqos_config",
|
||||
"lqos_sys",
|
||||
"notify",
|
||||
"parking_lot 0.12.1",
|
||||
"rayon",
|
||||
|
@ -9,6 +9,7 @@ serde = "1"
|
||||
serde_json = "1"
|
||||
lqos_bus = { path = "../lqos_bus" }
|
||||
lqos_config = { path = "../lqos_config" }
|
||||
lqos_sys = { path = "../lqos_sys" }
|
||||
log = "0"
|
||||
lazy_static = "1.4"
|
||||
parking_lot = "0"
|
||||
|
@ -3,7 +3,6 @@ use crate::{
|
||||
tracking::reader::read_named_queue_from_interface,
|
||||
};
|
||||
use anyhow::Result;
|
||||
use log::info;
|
||||
use lqos_config::LibreQoSConfig;
|
||||
use rayon::prelude::{IntoParallelRefMutIterator, ParallelIterator};
|
||||
use std::time::{Duration, Instant};
|
||||
@ -72,10 +71,10 @@ pub async fn spawn_queue_monitor() {
|
||||
let now = Instant::now();
|
||||
let _ = track_queues().await;
|
||||
let elapsed = now.elapsed();
|
||||
info!(
|
||||
"TC Reader tick with mapping consumed {} ms.",
|
||||
elapsed.as_millis()
|
||||
);
|
||||
//info!(
|
||||
// "TC Reader tick with mapping consumed {} ms.",
|
||||
// elapsed.as_millis()
|
||||
//);
|
||||
if elapsed.as_millis() < queue_check_period_ms as u128 {
|
||||
let duration = Duration::from_millis(queue_check_period_ms) - elapsed;
|
||||
tokio::time::sleep(duration).await;
|
||||
|
@ -37,13 +37,20 @@ fn unix_now() -> u64 {
|
||||
}
|
||||
|
||||
pub fn add_watched_queue(circuit_id: &str) {
|
||||
if WATCHED_QUEUES
|
||||
.read()
|
||||
.iter()
|
||||
.find(|q| q.circuit_id == circuit_id)
|
||||
.is_some()
|
||||
let max = unsafe { lqos_sys::libbpf_num_possible_cpus() } * 2;
|
||||
{
|
||||
return; // No duplicates, please
|
||||
let read_lock = WATCHED_QUEUES.read();
|
||||
if read_lock
|
||||
.iter()
|
||||
.find(|q| q.circuit_id == circuit_id)
|
||||
.is_some()
|
||||
{
|
||||
return; // No duplicates, please
|
||||
}
|
||||
|
||||
if read_lock.len() > max as usize {
|
||||
return; // Too many watched pots
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(queues) = &QUEUE_STRUCTURE.read().maybe_queues {
|
||||
|
Loading…
Reference in New Issue
Block a user