pub struct PerformanceSimulator { /* private fields */ }Expand description
Performance simulator
Orchestrates RPS control, bottleneck simulation, and latency recording.
Implementations§
Source§impl PerformanceSimulator
impl PerformanceSimulator
Sourcepub fn new(config: SimulatorConfig) -> Self
pub fn new(config: SimulatorConfig) -> Self
Create a new performance simulator
Sourcepub async fn is_running(&self) -> bool
pub async fn is_running(&self) -> bool
Check if simulator is running
Sourcepub async fn process_request(
&self,
endpoint: &str,
method: &str,
) -> Result<(), Error>
pub async fn process_request( &self, endpoint: &str, method: &str, ) -> Result<(), Error>
Process a request through the simulator
This should be called for each request to apply RPS control, bottleneck simulation, and latency recording.
Sourcepub async fn record_completion(
&self,
endpoint: &str,
method: &str,
latency_ms: u64,
status_code: u16,
error: Option<String>,
)
pub async fn record_completion( &self, endpoint: &str, method: &str, latency_ms: u64, status_code: u16, error: Option<String>, )
Record request completion with latency
Sourcepub async fn get_snapshot(&self) -> PerformanceSnapshot
pub async fn get_snapshot(&self) -> PerformanceSnapshot
Get current performance snapshot
Sourcepub fn rps_controller(&self) -> &Arc<RpsController>
pub fn rps_controller(&self) -> &Arc<RpsController>
Get RPS controller
Sourcepub fn bottleneck_simulator(&self) -> &Arc<BottleneckSimulator>
pub fn bottleneck_simulator(&self) -> &Arc<BottleneckSimulator>
Get bottleneck simulator
Sourcepub fn latency_analyzer(&self) -> &Arc<LatencyAnalyzer>
pub fn latency_analyzer(&self) -> &Arc<LatencyAnalyzer>
Get latency analyzer
Trait Implementations§
Source§impl Clone for PerformanceSimulator
impl Clone for PerformanceSimulator
Source§fn clone(&self) -> PerformanceSimulator
fn clone(&self) -> PerformanceSimulator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PerformanceSimulator
impl !RefUnwindSafe for PerformanceSimulator
impl Send for PerformanceSimulator
impl Sync for PerformanceSimulator
impl Unpin for PerformanceSimulator
impl !UnwindSafe for PerformanceSimulator
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