EncryptionBenchmark

Struct EncryptionBenchmark 

Source
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 second
  • latency: Time delay from operation start to completion
  • memory_usage_mb: Peak memory consumption during encryption
  • cpu_usage_percent: CPU utilization percentage during operation
  • file_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: EncryptionAlgorithm

The encryption algorithm that was benchmarked

§throughput_mbps: f64

Data processing throughput in megabytes per second

§latency: Duration

Operation latency from start to completion

§memory_usage_mb: f64

Peak memory usage during encryption in megabytes

§cpu_usage_percent: f64

CPU utilization percentage during the operation

§file_size_mb: f64

Size of the file being encrypted in megabytes (for context)

§timestamp: DateTime<Utc>

RFC3339-compliant timestamp when the benchmark was recorded

Implementations§

Source§

impl EncryptionBenchmark

Source

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 benchmarked
  • throughput_mbps - Data processing rate in megabytes per second
  • latency - Operation latency from start to completion
  • memory_usage_mb - Peak memory consumption during encryption
  • cpu_usage_percent - CPU utilization percentage during operation
  • file_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

Source§

fn clone(&self) -> EncryptionBenchmark

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EncryptionBenchmark

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for EncryptionBenchmark

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for EncryptionBenchmark

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,