diff --git a/.gitignore b/.gitignore index 2a7f2c58955d..5b846518e387 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ target/ # MSVC Windows builds of rustc generate these, which store debugging information *.pdb - # Generated by Intellij-based IDEs. .idea @@ -43,5 +42,8 @@ lcov.info # Generated by ./etc/generate-jwt.sh jwttoken/ +# Cache directory for CCLS, if using it with MDBX sources +.ccls-cache/ + # Generated by CMake due to MDBX sources crates/storage/libmdbx-rs/mdbx-sys/libmdbx/cmake-build-debug \ No newline at end of file diff --git a/crates/storage/libmdbx-rs/src/environment.rs b/crates/storage/libmdbx-rs/src/environment.rs index c1cf3b68deee..911a6a3c2e46 100644 --- a/crates/storage/libmdbx-rs/src/environment.rs +++ b/crates/storage/libmdbx-rs/src/environment.rs @@ -411,6 +411,25 @@ impl Info { pub fn num_readers(&self) -> usize { self.0.mi_numreaders as usize } + + /// Return the internal page ops metrics + #[inline] + pub fn page_ops(&self) -> PageOps { + PageOps { + newly: self.0.mi_pgop_stat.newly, + cow: self.0.mi_pgop_stat.cow, + clone: self.0.mi_pgop_stat.clone, + split: self.0.mi_pgop_stat.split, + merge: self.0.mi_pgop_stat.merge, + spill: self.0.mi_pgop_stat.spill, + unspill: self.0.mi_pgop_stat.unspill, + wops: self.0.mi_pgop_stat.wops, + prefault: self.0.mi_pgop_stat.prefault, + mincore: self.0.mi_pgop_stat.mincore, + msync: self.0.mi_pgop_stat.msync, + fsync: self.0.mi_pgop_stat.fsync, + } + } } impl fmt::Debug for Environment { @@ -429,6 +448,35 @@ pub enum PageSize { Set(usize), } +/// Statistics of page operations overall of all (running, completed and aborted) transactions +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct PageOps { + /// Quantity of a new pages added + pub newly: u64, + /// Quantity of pages copied for update + pub cow: u64, + /// Quantity of parent's dirty pages clones for nested transactions + pub clone: u64, + /// Page splits + pub split: u64, + /// Page merges + pub merge: u64, + /// Quantity of spilled dirty pages + pub spill: u64, + /// Quantity of unspilled/reloaded pages + pub unspill: u64, + /// Number of explicit write operations (not a pages) to a disk + pub wops: u64, + /// Number of explicit msync/flush-to-disk operations + pub msync: u64, + /// Number of explicit fsync/flush-to-disk operations + pub fsync: u64, + /// Number of prefault write operations + pub prefault: u64, + /// Number of mincore() calls + pub mincore: u64, +} + #[derive(Clone, Debug, PartialEq, Eq)] pub struct Geometry { pub size: Option,