Skip to content

Commit 7968e86

Browse files
committed
fix: mmapfile
Signed-off-by: bkioshn <[email protected]>
1 parent 4a6ab32 commit 7968e86

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

rust/cardano-chain-follower/src/stats/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ pub(crate) mod thread;
99
use std::sync::{Arc, LazyLock, RwLock};
1010

1111
use cardano_blockchain_types::{Network, Slot};
12-
use catalyst_types::mmap_file::MemMapFileStat;
1312
use chrono::Utc;
1413
use dashmap::DashMap;
1514
use rollback::{rollbacks, rollbacks_reset, RollbackType};
@@ -31,8 +30,6 @@ pub struct Statistics {
3130
pub mithril: Mithril,
3231
/// Statistics related to the threads.
3332
pub thread_stats: DashMap<String, thread::ThreadStat>,
34-
/// Statistics related to the memory mapped files.
35-
pub mmap_file_stat: MemMapFileStat,
3633
}
3734

3835
/// Type we use to manage the Sync Task handle map.
@@ -557,7 +554,7 @@ pub fn thread_stat(chain: Network, name: &str) -> Option<ThreadStat> {
557554

558555
/// Get the names of all the thread statistics.
559556
#[allow(dead_code)]
560-
pub fn thread_stat_name(chain: Network) -> Vec<String> {
557+
pub fn thread_stat_names(chain: Network) -> Vec<String> {
561558
let Some(stats) = lookup_stats(chain) else {
562559
return Vec::new();
563560
};

rust/catalyst-types/src/mmap_file.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ static MEMMAP_FILE_STATS: Lazy<MemMapFileStat> = Lazy::new(MemMapFileStat::defau
2727
#[derive(Debug, Default, Clone, Serialize)]
2828
pub struct MemMapFileStat(Arc<MemMapFileStatInner>);
2929

30+
/// Internal structure to hold stats.
31+
struct MemMapFileStatInner {
32+
/// A counter for the number of memory-mapped files.
33+
file_count: AtomicU64,
34+
/// The total size of memory-mapped files.
35+
total_size: AtomicU64,
36+
/// The amount of time that memory-mapped files have been dropped.
37+
drop_count: AtomicU64,
38+
/// The total size of memory-mapped files that have been dropped.
39+
drop_size: AtomicU64,
40+
/// A count of errors encountered.
41+
error_count: AtomicU64,
42+
}
43+
3044
impl MemMapFileStat {
3145
/// Get the statistic file count.
3246
#[must_use]
@@ -59,20 +73,6 @@ impl MemMapFileStat {
5973
}
6074
}
6175

62-
/// Internal structure to hold stats.
63-
struct MemMapFileStatInner {
64-
/// A counter for the number of memory-mapped files.
65-
file_count: AtomicU64,
66-
/// The total size of memory-mapped files.
67-
total_size: AtomicU64,
68-
/// The amount of time that memory-mapped files have been dropped.
69-
drop_count: AtomicU64,
70-
/// The total size of memory-mapped files that have been dropped.
71-
drop_size: AtomicU64,
72-
/// A count of errors encountered.
73-
error_count: AtomicU64,
74-
}
75-
7676
impl MemoryMapFile {
7777
/// Get the memory-mapped file.
7878
pub fn file(&self) -> &MmapFile {

0 commit comments

Comments
 (0)