Skip to content

Commit

Permalink
Add PerformanceMetricsStorageAdapter::reset()
Browse files Browse the repository at this point in the history
  • Loading branch information
LDeakin committed Oct 31, 2024
1 parent 68b9b29 commit 952f543
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions zarrs_storage/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- Add `ByteRange::new` and `From` for `RangeBounds<u64>`
- Add `PerformanceMetricsStorageAdapter::reset()`

### Changed
- Bump `unsafe_cell_slice` to 0.2.0
Expand Down
8 changes: 8 additions & 0 deletions zarrs_storage/src/storage_adapter/performance_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ impl<TStorage: ?Sized> PerformanceMetricsStorageAdapter<TStorage> {
}
}

/// Reset the performance metrics.
pub fn reset(&self) {
self.bytes_read.store(0, Ordering::Relaxed);
self.bytes_written.store(0, Ordering::Relaxed);
self.reads.store(0, Ordering::Relaxed);
self.writes.store(0, Ordering::Relaxed);
}

/// Returns the number of bytes read.
pub fn bytes_read(&self) -> usize {
self.bytes_read.load(Ordering::Relaxed)
Expand Down

0 comments on commit 952f543

Please sign in to comment.