Skip to content

Commit

Permalink
*: upgrade array_zip
Browse files Browse the repository at this point in the history
See rust-lang/rust/pull/112096

Signed-off-by: Neil Shen <overvenus@gmail.com>
  • Loading branch information
overvenus committed Dec 15, 2023
1 parent 0efbda5 commit a531474
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
1 change: 0 additions & 1 deletion components/resource_control/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2022 TiKV Project Authors. Licensed under Apache-2.0.
#![feature(test)]
#![feature(local_key_cell_methods)]
#![feature(array_zip)]

use std::sync::Arc;

Expand Down
8 changes: 4 additions & 4 deletions components/resource_control/src/resource_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ impl ResourceGroupManager {
#[inline]
pub fn get_priority_resource_limiters(
&self,
) -> [Arc<ResourceLimiter>; TaskPriority::PRIORITY_COUNT] {
self.priority_limiters.clone()
) -> &[Arc<ResourceLimiter>; TaskPriority::PRIORITY_COUNT] {
&self.priority_limiters
}
}

Expand Down Expand Up @@ -606,8 +606,8 @@ impl ResourceController {
});
if near_overflow {
let end = Instant::now_coarse();
info!("all resource groups' virtual time are near overflow, do reset";
"min" => min_vt, "max" => max_vt, "dur" => ?end.duration_since(start),
info!("all resource groups' virtual time are near overflow, do reset";
"min" => min_vt, "max" => max_vt, "dur" => ?end.duration_since(start),
"reset_dur" => ?end.duration_since(self.last_rest_vt_time.get()));
max_vt -= RESET_VT_THRESHOLD;
self.last_rest_vt_time.set(end);
Expand Down
15 changes: 9 additions & 6 deletions components/resource_control/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,13 @@ impl<R: ResourceStatsProvider> PriorityLimiterAdjustWorker<R> {
resource_ctl: Arc<ResourceGroupManager>,
resource_quota_getter: R,
) -> Self {
let trackers = resource_ctl
.get_priority_resource_limiters()
.zip(TaskPriority::priorities())
.map(|(l, p)| PriorityLimiterStatsTracker::new(l, p.as_str()));
let limiters = resource_ctl.get_priority_resource_limiters();
let priorities = TaskPriority::priorities();
let trackers = [
PriorityLimiterStatsTracker::new(limiters[0].clone(), priorities[0].as_str()),
PriorityLimiterStatsTracker::new(limiters[1].clone(), priorities[1].as_str()),
PriorityLimiterStatsTracker::new(limiters[2].clone(), priorities[2].as_str()),
];
Self {
resource_ctl,
trackers,
Expand Down Expand Up @@ -447,9 +450,9 @@ impl<R: ResourceStatsProvider> PriorityLimiterAdjustWorker<R> {
limits[i - 1] = limit;
expect_cpu_time_total -= level_expected[i];
}
debug!("adjsut cpu limiter by priority"; "cpu_quota" => process_cpu_stats.total_quota,
debug!("adjsut cpu limiter by priority"; "cpu_quota" => process_cpu_stats.total_quota,
"process_cpu" => process_cpu_stats.current_used, "expected_cpu" => ?level_expected,
"cpu_costs" => ?cpu_duration, "limits" => ?limits,
"cpu_costs" => ?cpu_duration, "limits" => ?limits,
"limit_cpu_total" => expect_pool_cpu_total, "pool_cpu_cost" => real_cpu_total);
}
}
Expand Down

0 comments on commit a531474

Please sign in to comment.