pub struct EncryptionBenchmark {
pub algorithm: EncryptionAlgorithm,
pub throughput_mbps: f64,
pub latency: Duration,
pub memory_usage_mb: f64,
pub cpu_usage_percent: f64,
pub file_size_mb: f64,
pub timestamp: DateTime<Utc>,
}Expand description
Encryption performance benchmark results for algorithm comparison and optimization.
EncryptionBenchmark is a value object that captures comprehensive
performance metrics for encryption operations, enabling data-driven
decisions about algorithm selection, resource allocation, and system
optimization in the adaptive pipeline.
§Key Features
- Comprehensive Metrics: Captures throughput, latency, memory usage, and CPU utilization
- Algorithm Tracking: Associates metrics with specific encryption algorithms
- Temporal Context: Includes RFC3339-compliant timestamp for trend analysis
- Immutable Snapshot: Represents performance at a specific point in time
- Serialization Ready: Full serde support for persistence and data exchange
§Performance Metrics
throughput_mbps: Data processing rate in megabytes per secondlatency: Time delay from operation start to completionmemory_usage_mb: Peak memory consumption during encryptioncpu_usage_percent: CPU utilization percentage during operationfile_size_mb: Size of the file being encrypted (for context)
§Usage Patterns
§Integration with Monitoring
The benchmark integrates with the pipeline’s monitoring and optimization systems:
- Performance Tracking: Historical performance data for trend analysis
- Algorithm Selection: Data-driven algorithm choice based on workload characteristics
- Resource Planning: Memory and CPU requirement estimation
- Optimization Feedback: Performance regression detection and optimization validation
§Thread Safety
EncryptionBenchmark is thread-safe through immutability. All fields are
read-only after construction, making it safe to share across threads without
synchronization.
§Cross-Language Compatibility
The benchmark data structure maps well to other languages:
- JSON: Direct serialization for REST APIs and configuration
- Go: Struct with similar field types and JSON tags
- Python: Dataclass or NamedTuple with datetime handling
- Database: Relational table with appropriate column types
§Performance Considerations
- Lightweight value object with minimal memory overhead
- Efficient serialization through serde derive macros
- Immutable design eliminates defensive copying
- Timestamp generation uses UTC to avoid timezone complexity
Fields§
§algorithm: EncryptionAlgorithmThe encryption algorithm that was benchmarked
throughput_mbps: f64Data processing throughput in megabytes per second
latency: DurationOperation latency from start to completion
memory_usage_mb: f64Peak memory usage during encryption in megabytes
cpu_usage_percent: f64CPU utilization percentage during the operation
file_size_mb: f64Size of the file being encrypted in megabytes (for context)
timestamp: DateTime<Utc>RFC3339-compliant timestamp when the benchmark was recorded
Implementations§
Source§impl EncryptionBenchmark
impl EncryptionBenchmark
Sourcepub fn new(
algorithm: EncryptionAlgorithm,
throughput_mbps: f64,
latency: Duration,
memory_usage_mb: f64,
cpu_usage_percent: f64,
file_size_mb: f64,
) -> Self
pub fn new( algorithm: EncryptionAlgorithm, throughput_mbps: f64, latency: Duration, memory_usage_mb: f64, cpu_usage_percent: f64, file_size_mb: f64, ) -> Self
Creates a new encryption benchmark with the specified performance metrics.
The benchmark captures a snapshot of encryption performance at the current time, providing comprehensive metrics for algorithm comparison and optimization decisions.
§Arguments
algorithm- The encryption algorithm that was benchmarkedthroughput_mbps- Data processing rate in megabytes per secondlatency- Operation latency from start to completionmemory_usage_mb- Peak memory consumption during encryptioncpu_usage_percent- CPU utilization percentage during operationfile_size_mb- Size of the file being encrypted (for context)
§Returns
A new EncryptionBenchmark instance with the current UTC timestamp.
§Examples
§Performance Metrics Guidelines
- Throughput: Measure sustained data processing rate, not peak burst
- Latency: Include full operation time from API call to completion
- Memory: Capture peak usage, not average or final usage
- CPU: Measure during active encryption, not including I/O wait
- File Size: Provide context for performance scaling analysis
Trait Implementations§
Source§impl Clone for EncryptionBenchmark
impl Clone for EncryptionBenchmark
Source§fn clone(&self) -> EncryptionBenchmark
fn clone(&self) -> EncryptionBenchmark
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EncryptionBenchmark
impl Debug for EncryptionBenchmark
Source§impl<'de> Deserialize<'de> for EncryptionBenchmark
impl<'de> Deserialize<'de> for EncryptionBenchmark
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for EncryptionBenchmark
impl RefUnwindSafe for EncryptionBenchmark
impl Send for EncryptionBenchmark
impl Sync for EncryptionBenchmark
impl Unpin for EncryptionBenchmark
impl UnwindSafe for EncryptionBenchmark
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 more