Skip to content

Commit a531474

Browse files
committed
*: upgrade array_zip
See rust-lang/rust/pull/112096 Signed-off-by: Neil Shen <[email protected]>
1 parent 0efbda5 commit a531474

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

components/resource_control/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2022 TiKV Project Authors. Licensed under Apache-2.0.
22
#![feature(test)]
33
#![feature(local_key_cell_methods)]
4-
#![feature(array_zip)]
54

65
use std::sync::Arc;
76

components/resource_control/src/resource_group.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ impl ResourceGroupManager {
342342
#[inline]
343343
pub fn get_priority_resource_limiters(
344344
&self,
345-
) -> [Arc<ResourceLimiter>; TaskPriority::PRIORITY_COUNT] {
346-
self.priority_limiters.clone()
345+
) -> &[Arc<ResourceLimiter>; TaskPriority::PRIORITY_COUNT] {
346+
&self.priority_limiters
347347
}
348348
}
349349

@@ -606,8 +606,8 @@ impl ResourceController {
606606
});
607607
if near_overflow {
608608
let end = Instant::now_coarse();
609-
info!("all resource groups' virtual time are near overflow, do reset";
610-
"min" => min_vt, "max" => max_vt, "dur" => ?end.duration_since(start),
609+
info!("all resource groups' virtual time are near overflow, do reset";
610+
"min" => min_vt, "max" => max_vt, "dur" => ?end.duration_since(start),
611611
"reset_dur" => ?end.duration_since(self.last_rest_vt_time.get()));
612612
max_vt -= RESET_VT_THRESHOLD;
613613
self.last_rest_vt_time.set(end);

components/resource_control/src/worker.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,13 @@ impl<R: ResourceStatsProvider> PriorityLimiterAdjustWorker<R> {
332332
resource_ctl: Arc<ResourceGroupManager>,
333333
resource_quota_getter: R,
334334
) -> Self {
335-
let trackers = resource_ctl
336-
.get_priority_resource_limiters()
337-
.zip(TaskPriority::priorities())
338-
.map(|(l, p)| PriorityLimiterStatsTracker::new(l, p.as_str()));
335+
let limiters = resource_ctl.get_priority_resource_limiters();
336+
let priorities = TaskPriority::priorities();
337+
let trackers = [
338+
PriorityLimiterStatsTracker::new(limiters[0].clone(), priorities[0].as_str()),
339+
PriorityLimiterStatsTracker::new(limiters[1].clone(), priorities[1].as_str()),
340+
PriorityLimiterStatsTracker::new(limiters[2].clone(), priorities[2].as_str()),
341+
];
339342
Self {
340343
resource_ctl,
341344
trackers,
@@ -447,9 +450,9 @@ impl<R: ResourceStatsProvider> PriorityLimiterAdjustWorker<R> {
447450
limits[i - 1] = limit;
448451
expect_cpu_time_total -= level_expected[i];
449452
}
450-
debug!("adjsut cpu limiter by priority"; "cpu_quota" => process_cpu_stats.total_quota,
453+
debug!("adjsut cpu limiter by priority"; "cpu_quota" => process_cpu_stats.total_quota,
451454
"process_cpu" => process_cpu_stats.current_used, "expected_cpu" => ?level_expected,
452-
"cpu_costs" => ?cpu_duration, "limits" => ?limits,
455+
"cpu_costs" => ?cpu_duration, "limits" => ?limits,
453456
"limit_cpu_total" => expect_pool_cpu_total, "pool_cpu_cost" => real_cpu_total);
454457
}
455458
}

0 commit comments

Comments
 (0)