pub struct AtomicBitmap { /* private fields */ }
Expand description

AtomicBitmap implements a simple bit map on the page level with test and set operations. It is page-size aware, so it converts addresses to page numbers before setting or clearing the bits.

Implementations§

source§

impl AtomicBitmap

source

pub fn new(byte_size: usize, page_size: NonZeroUsize) -> Self

Create a new bitmap of byte_size, with one bit per page. This is effectively rounded up, and we get a new vector of the next multiple of 64 bigger than bit_size.

source

pub fn is_bit_set(&self, index: usize) -> bool

Is bit n set? Bits outside the range of the bitmap are always unset.

source

pub fn is_addr_set(&self, addr: usize) -> bool

Is the bit corresponding to address addr set?

source

pub fn set_addr_range(&self, start_addr: usize, len: usize)

Set a range of len bytes starting at start_addr. The first bit set in the bitmap is for the page corresponding to start_addr, and the last bit that we set corresponds to address start_addr + len - 1.

source

pub fn len(&self) -> usize

Get the length of the bitmap in bits (i.e. in how many pages it can represent).

source

pub fn get_and_reset(&self) -> Vec<u64>

Atomically get and reset the dirty page bitmap.

source

pub fn reset(&self)

Reset all bitmap bits to 0.

Trait Implementations§

source§

impl Bitmap for AtomicBitmap

source§

fn mark_dirty(&self, offset: usize, len: usize)

Mark the memory range specified by the given offset and len as dirtied.
source§

fn dirty_at(&self, offset: usize) -> bool

Check whether the specified offset is marked as dirty.
source§

fn slice_at(&self, offset: usize) -> <Self as WithBitmapSlice<'_>>::S

Return a <Self as WithBitmapSlice>::S slice of the current bitmap, starting at the specified offset.
source§

impl Clone for AtomicBitmap

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for AtomicBitmap

source§

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

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

impl Default for AtomicBitmap

source§

fn default() -> Self

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

impl NewBitmap for AtomicBitmap

source§

fn with_len(len: usize) -> Self

Create a new object based on the specified length in bytes.
source§

impl<'a> WithBitmapSlice<'a> for AtomicBitmap

§

type S = BaseSlice<&'a AtomicBitmap>

Type of the bitmap slice.

Auto Trait Implementations§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.