move stats in bucket_stats

This commit is contained in:
Brooks Prumo
2021-09-16 16:18:29 -05:00
committed by Jeff Washington (jwash)
parent 45b9d7980a
commit 93c1de59ed
4 changed files with 21 additions and 17 deletions

View File

@ -1,7 +1,7 @@
//! BucketMap is a mostly contention free concurrent map backed by MmapMut
use crate::bucket::Bucket;
use crate::data_bucket::BucketMapStats;
use crate::bucket_stats::BucketMapStats;
use solana_sdk::pubkey::Pubkey;
use std::convert::TryInto;
use std::fmt::Debug;

View File

@ -0,0 +1,18 @@
use std::sync::Arc;
use std::sync::{atomic::AtomicU64, Mutex};
#[derive(Debug, Default)]
pub struct BucketStats {
pub resizes: AtomicU64,
pub max_size: Mutex<u64>,
pub resize_us: AtomicU64,
pub new_file_us: AtomicU64,
pub flush_file_us: AtomicU64,
pub mmap_us: AtomicU64,
}
#[derive(Debug, Default, Clone)]
pub struct BucketMapStats {
pub index: Arc<BucketStats>,
pub data: Arc<BucketStats>,
}

View File

@ -1,4 +1,5 @@
use crate::bucket_map::MaxSearch;
use crate::bucket_stats::BucketStats;
use memmap2::MmapMut;
use rand::{thread_rng, Rng};
use solana_measure::measure::Measure;
@ -10,24 +11,8 @@ use std::path::PathBuf;
use std::sync::Arc;
use std::sync::{
atomic::{AtomicU64, Ordering},
Mutex,
};
#[derive(Debug, Default)]
pub struct BucketStats {
pub resizes: AtomicU64,
pub max_size: Mutex<u64>,
pub resize_us: AtomicU64,
pub new_file_us: AtomicU64,
pub flush_file_us: AtomicU64,
pub mmap_us: AtomicU64,
}
#[derive(Debug, Default, Clone)]
pub struct BucketMapStats {
pub index: Arc<BucketStats>,
pub data: Arc<BucketStats>,
}
/*
1 2

View File

@ -3,5 +3,6 @@
#![allow(clippy::mut_from_ref)]
mod bucket;
pub mod bucket_map;
mod bucket_stats;
mod bucket_storage;
mod index_entry;