Skip to content

Commit

Permalink
refactor: 调试时输出附加限制表
Browse files Browse the repository at this point in the history
  • Loading branch information
shadow3aaa committed Dec 29, 2024
1 parent 021f019 commit e526ef8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cpu_common/extra_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@
// You should have received a copy of the GNU General Public License along
// with fas-rs. If not, see <https://www.gnu.org/licenses/>.

#[derive(Debug)]
pub enum ExtraPolicy {
AbsRangeBound(AbsRangeBound),
RelRangeBound(RelRangeBound),
None,
}

#[derive(Debug)]
pub struct AbsRangeBound {
pub min: Option<isize>,
pub max: Option<isize>,
}

#[derive(Debug)]
pub struct RelRangeBound {
pub rel_to: i32,
pub min: Option<isize>,
Expand Down
8 changes: 8 additions & 0 deletions src/framework/extension/api/helper_funs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
use std::sync::atomic::{AtomicBool, Ordering};

use anyhow::Context;
#[cfg(debug_assertions)]
use log::debug;
use log::warn;

use crate::cpu_common::{
Expand Down Expand Up @@ -53,6 +55,9 @@ pub fn set_extra_policy_abs(policy: i32, min: Option<isize>, max: Option<isize>)
.context("CPU Policy not found")
.unwrap()
.lock() = extra_policy;

#[cfg(debug_assertions)]
debug!("EXTRA_POLICY_MAP: {:?}", EXTRA_POLICY_MAP.get().unwrap());
}

pub fn set_extra_policy_rel(
Expand All @@ -79,6 +84,9 @@ pub fn set_extra_policy_rel(
.context("CPU Policy not found")
.unwrap()
.lock() = extra_policy;

#[cfg(debug_assertions)]
debug!("EXTRA_POLICY_MAP: {:?}", EXTRA_POLICY_MAP.get().unwrap());
}

pub fn set_policy_freq_offset(_: i32, _: isize) {
Expand Down

0 comments on commit e526ef8

Please sign in to comment.