Function l1_cache_size

Source
pub fn l1_cache_size() -> Option<usize>
Expand description

Returns the total size in bytes of the L1 data cache.

The only possibilities for this returning None are if the system does not support cache parameters, in which case get_cache_parameters() will fail, or if the system has no L1 data cache (if it’s a unified L1 cache for example).

This is computed as associativity * line_size * sets, and if there are multiple caches available, it returns the size of the smallest cache.