Skip to main content

PerformanceDatabase

Struct PerformanceDatabase 

Source
pub struct PerformanceDatabase<A: Float> { /* private fields */ }
Expand description

Historical performance database

Implementations§

Source§

impl<A: Float + Debug + Serialize + for<'de> Deserialize<'de> + Send + Sync> PerformanceDatabase<A>

Source

pub fn new() -> Self

Create a new empty performance database

Source

pub fn load(basedir: &Path) -> Result<Self>

Load database from disk

Source

pub fn save(&self, basedir: &Path) -> Result<()>

Save database to disk

Source

pub fn add_record(&mut self, key: String, record: PerformanceRecord<A>)

Add a performance record with history size management

Source

pub fn add_record_with_limit( &mut self, key: String, record: PerformanceRecord<A>, max_history: usize, )

Add a performance record with custom history limit

Source

pub fn get_history(&self, key: &str) -> Option<&VecDeque<PerformanceRecord<A>>>

Get performance history for a specific key

Source

pub fn get_history_mut( &mut self, key: &str, ) -> Option<&mut VecDeque<PerformanceRecord<A>>>

Get mutable performance history for a specific key

Source

pub fn get_keys(&self) -> Vec<&String>

Get all keys with performance history

Source

pub fn get_recent_records( &self, key: &str, count: usize, ) -> Vec<&PerformanceRecord<A>>

Get recent records for a key (last N records)

Source

pub fn cleanup_old_records(&mut self, cutoff_timestamp: u64) -> usize

Remove old records based on timestamp (older than given timestamp)

Source

pub fn total_records(&self) -> usize

Get total number of records across all keys

Source

pub fn key_count(&self) -> usize

Get number of unique keys

Source

pub fn metadata(&self) -> &DatabaseMetadata

Get database metadata

Source

pub fn is_empty(&self) -> bool

Check if database has any data

Source

pub fn get_records_by_commit( &self, commit_hash: &str, ) -> Vec<(&String, &PerformanceRecord<A>)>

Get records for a specific commit hash

Source

pub fn get_records_by_branch( &self, branch: &str, ) -> Vec<(&String, &PerformanceRecord<A>)>

Get records for a specific branch

Source

pub fn get_records_by_time_range( &self, start_timestamp: u64, end_timestamp: u64, ) -> Vec<(&String, &PerformanceRecord<A>)>

Get records within a time range

Source

pub fn export_json(&self) -> Result<String>

Export database to JSON string

Source

pub fn import_json(json_data: &str) -> Result<Self>

Import database from JSON string

Source

pub fn merge(&mut self, other: PerformanceDatabase<A>)

Merge another database into this one

Source

pub fn compact(&mut self) -> usize

Compact database by removing duplicate records

Trait Implementations§

Source§

impl<A: Debug + Float> Debug for PerformanceDatabase<A>

Source§

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

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

impl<A: Float + Debug + Serialize + for<'de> Deserialize<'de> + Send + Sync> Default for PerformanceDatabase<A>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, A> Deserialize<'de> for PerformanceDatabase<A>
where A: Deserialize<'de> + Float,

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<A> Serialize for PerformanceDatabase<A>
where A: Serialize + Float,

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§

§

impl<A> Freeze for PerformanceDatabase<A>

§

impl<A> RefUnwindSafe for PerformanceDatabase<A>
where A: RefUnwindSafe,

§

impl<A> Send for PerformanceDatabase<A>
where A: Send,

§

impl<A> Sync for PerformanceDatabase<A>
where A: Sync,

§

impl<A> Unpin for PerformanceDatabase<A>
where A: Unpin,

§

impl<A> UnsafeUnpin for PerformanceDatabase<A>

§

impl<A> UnwindSafe for PerformanceDatabase<A>
where A: UnwindSafe,

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> 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<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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>,