pub struct AdaptiveRuntimeSelector;Expand description
自适应运行时选择器
Implementations§
Source§impl AdaptiveRuntimeSelector
impl AdaptiveRuntimeSelector
Sourcepub fn select_runtime(resources: &SystemResources) -> RuntimeType
pub fn select_runtime(resources: &SystemResources) -> RuntimeType
根据系统资源选择最优运行时类型
§选择策略
- Low: 同步运行时(开销最小,适合低配机器)
- Medium: 异步运行时(平衡性能和开销)
- High: Actor运行时(最大并发能力)
§参数
resources- 系统资源信息
§返回值
RuntimeType- 推荐的运行时类型
§示例
let resources = SystemResources::detect();
let runtime_type = AdaptiveRuntimeSelector::select_runtime(&resources);
println!("推荐运行时: {:?}", runtime_type);Sourcepub fn generate_config(resources: &SystemResources) -> ForgeConfig
pub fn generate_config(resources: &SystemResources) -> ForgeConfig
根据系统资源生成优化的运行时配置
自动调整以下参数:
- 并发任务数(基于CPU线程数)
- 队列大小(基于可用内存)
- 超时配置(基于资源等级)
- 监控采样率(基于资源等级)
§参数
resources- 系统资源信息
§返回值
ForgeConfig- 优化后的配置
§示例
let resources = SystemResources::detect();
let config = AdaptiveRuntimeSelector::generate_config(&resources);
println!("并发任务数: {}", config.processor.max_concurrent_tasks);Auto Trait Implementations§
impl Freeze for AdaptiveRuntimeSelector
impl RefUnwindSafe for AdaptiveRuntimeSelector
impl Send for AdaptiveRuntimeSelector
impl Sync for AdaptiveRuntimeSelector
impl Unpin for AdaptiveRuntimeSelector
impl UnwindSafe for AdaptiveRuntimeSelector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage