Struct mmtk::util::options::Options

source ·
pub struct Options {
Show 22 fields pub plan: MMTKOption<PlanSelector>, pub threads: MMTKOption<usize>, pub use_short_stack_scans: MMTKOption<bool>, pub use_return_barrier: MMTKOption<bool>, pub eager_complete_sweep: MMTKOption<bool>, pub ignore_system_gc: MMTKOption<bool>, pub nursery: MMTKOption<NurserySize>, pub full_heap_system_gc: MMTKOption<bool>, pub no_finalizer: MMTKOption<bool>, pub no_reference_types: MMTKOption<bool>, pub nursery_zeroing: MMTKOption<NurseryZeroingOptions>, pub stress_factor: MMTKOption<usize>, pub analysis_factor: MMTKOption<usize>, pub precise_stress: MMTKOption<bool>, pub vm_space_start: MMTKOption<Address>, pub vm_space_size: MMTKOption<usize>, pub work_perf_events: MMTKOption<PerfEventOptions>, pub phase_perf_events: MMTKOption<PerfEventOptions>, pub perf_exclude_kernel: MMTKOption<bool>, pub thread_affinity: MMTKOption<AffinityKind>, pub gc_trigger: MMTKOption<GCTriggerSelector>, pub transparent_hugepages: MMTKOption<bool>,
Expand description

MMTk command line options.


§plan: MMTKOption<PlanSelector>

The GC plan to use.

§threads: MMTKOption<usize>

Number of GC worker threads. (There is always one GC controller thread besides the GC workers)

§use_short_stack_scans: MMTKOption<bool>

Enable an optimization that only scans the part of the stack that has changed since the last GC (not supported)

§use_return_barrier: MMTKOption<bool>

Enable a return barrier (not supported)

§eager_complete_sweep: MMTKOption<bool>

Should we eagerly finish sweeping at the start of a collection? (not supported)

§ignore_system_gc: MMTKOption<bool>

Should we ignore GCs requested by the user (e.g. java.lang.System.gc)?

§nursery: MMTKOption<NurserySize>

The nursery size for generational plans. It can be one of Bounded or Fixed. The size for a Bounded nursery only controls the upper bound, whereas the size for a Fixed nursery controls both the upper and lower bounds. The nursery size can be set like ‘Fixed:8192’, for example, to have a Fixed nursery size of 8192 bytes

§full_heap_system_gc: MMTKOption<bool>

Should a major GC be performed when a system GC is required?

§no_finalizer: MMTKOption<bool>

Should finalization be disabled?

§no_reference_types: MMTKOption<bool>

Should reference type processing be disabled? If reference type processing is disabled, no weak reference processing work is scheduled, and we expect a binding to treat weak references as strong references. We disable weak reference processing by default, as we are still working on it. This will be changed to false once weak reference processing is implemented properly.

§nursery_zeroing: MMTKOption<NurseryZeroingOptions>

The zeroing approach to use for new object allocations. Affects each plan differently. (not supported)

§stress_factor: MMTKOption<usize>

How frequent (every X bytes) should we do a stress GC?

§analysis_factor: MMTKOption<usize>

How frequent (every X bytes) should we run analysis (a STW event that collects data)

§precise_stress: MMTKOption<bool>

Precise stress test. Trigger stress GCs exactly at X bytes if this is true. This is usually used to test the GC correctness and will significantly slow down the mutator performance. If this is false, stress GCs will only be triggered when an allocation reaches the slow path. This means we may have allocated more than X bytes or fewer than X bytes when we actually trigger a stress GC. But this should have no obvious mutator overhead, and can be used to test GC performance along with a larger stress factor (e.g. tens of metabytes).

§vm_space_start: MMTKOption<Address>

The start of vmspace.

§vm_space_size: MMTKOption<usize>

The size of vmspace.

§work_perf_events: MMTKOption<PerfEventOptions>

Perf events to measure Semicolons are used to separate events Each event is in the format of event_name,pid,cpu (see man perf_event_open for what pid and cpu mean). For example, PERF_COUNT_HW_CPU_CYCLES,0,-1 measures the CPU cycles for the current process on all the CPU cores. Measuring perf events for work packets. NOTE that be VERY CAREFUL when using this option, as this may greatly slowdown GC performance.

§phase_perf_events: MMTKOption<PerfEventOptions>

Measuring perf events for GC and mutators

§perf_exclude_kernel: MMTKOption<bool>

Should we exclude perf events occurring in kernel space. By default we include the kernel. Only set this option if you know the implications of excluding the kernel!

§thread_affinity: MMTKOption<AffinityKind>

Set how to bind affinity to the GC Workers. Default thread affinity delegates to the OS scheduler. If a list of cores are specified, cores are allocated to threads in a round-robin fashion. The core ids should match the ones reported by /proc/cpuinfo. Core ids are separated by commas and may include ranges. There should be no spaces in the core list. For example: 0,5,8-11 specifies that cores 0,5,8,9,10,11 should be used for pinning threads. Note that in the case the program has only been allocated a certain number of cores using taskset, the core ids in the list should be specified by their perceived index as using taskset will essentially re-label the core ids. For example, running the program with MMTK_THREAD_AFFINITY="0-4" taskset -c 6-12 <program> means that the cores 6,7,8,9,10 will be used to pin threads even though we specified the core ids “0,1,2,3,4”. MMTK_THREAD_AFFINITY="12" taskset -c 6-12 <program> will not work, on the other hand, as there is no core with (perceived) id 12.

§gc_trigger: MMTKOption<GCTriggerSelector>

Set the GC trigger. This defines the heap size and how MMTk triggers a GC. Default to a fixed heap size of 0.5x physical memory.

§transparent_hugepages: MMTKOption<bool>

Enable transparent hugepage support via madvise (only Linux is supported)



impl Options


pub fn get_max_nursery_bytes(&self) -> usize

Return upper bound of the nursery size (in number of bytes)


pub fn get_max_nursery_pages(&self) -> usize

Return upper bound of the nursery size (in number of pages)


pub fn get_min_nursery_bytes(&self) -> usize

Return lower bound of the nursery size (in number of bytes)


pub fn get_min_nursery_pages(&self) -> usize

Return lower bound of the nursery size (in number of pages)


pub fn is_stress_test_gc_enabled(&self) -> bool

Check if the options are set for stress GC. If either stress_factor or analysis_factor is set, we should do stress GC.


impl Options


pub fn set_from_env_var(&mut self, s: &str, val: &str) -> bool

Set an option from env var


pub fn set_from_command_line(&mut self, s: &str, val: &str) -> bool

Set an option from command line


pub fn set_bulk_from_command_line(&mut self, options: &str) -> bool

Bulk process options. Returns true if all the options are processed successfully. This method returns false if the option string is invalid, or if it includes any invalid option.


  • options: a string that is key value pairs separated by white spaces or commas, e.g. threads=1 stress_factor=4096, or threads=1,stress_factor=4096

fn set_inner(&mut self, s: &str, val: &str) -> bool

Set an option and run its validator for its value.


fn new() -> Self

Create an Options instance with built-in default settings.


pub fn read_env_var_settings(&mut self)

Read options from environment variables, and apply those settings to self.

If we have environment variables that start with MMTK_ and match any option (such as MMTK_STRESS_FACTOR), we set the option to its value (if it is a valid value).

Trait Implementations§


impl Clone for Options


fn clone(&self) -> Options

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

impl Default for Options


fn default() -> Self

By default, Options instance is created with built-in default settings.

Auto Trait Implementations§

Blanket Implementations§


impl<T> Any for Twhere T: 'static + ?Sized,


fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl<T> Borrow<T> for Twhere T: ?Sized,


fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for Twhere T: ?Sized,


fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl<T> Downcast for Twhere T: Any,


fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.

impl<T> DowncastSync for Twhere T: Any + Send + Sync,


fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send + 'static>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.

impl<T> From<T> for T


fn from(t: T) -> T

Returns the argument unchanged.


impl<T, U> Into<U> for Twhere U: From<T>,


fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.


impl<T> Pointable for T


const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.

type Init = T

The type for initializers.

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T> ToOwned for Twhere T: Clone,


type Owned = T

The resulting type after obtaining ownership.

fn to_owned(&self) -> T

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

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

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

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


type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,


type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.