mirror of
https://github.com/Zenithsiz/ftmemsim.git
synced 2026-02-03 09:50:32 +00:00
Improved how random-rw handles random page generation.
Added more realistic values for `{simple, random}-rw`.
This commit is contained in:
parent
9bbf7dafe6
commit
684c0c9f5c
@ -8,14 +8,14 @@
|
||||
"memories": [
|
||||
{
|
||||
"name": "ram",
|
||||
"page_capacity": 512,
|
||||
"page_capacity": 32768,
|
||||
"read_latency_ns": 1.5,
|
||||
"write_latency_ns": 1.0,
|
||||
"fault_latency_ns": 10.0
|
||||
},
|
||||
{
|
||||
"name": "optane",
|
||||
"page_capacity": 1048576,
|
||||
"page_capacity": 262144,
|
||||
"read_latency_ns": 5.0,
|
||||
"write_latency_ns": 4.0,
|
||||
"fault_latency_ns": 50.0
|
||||
|
||||
@ -9,8 +9,8 @@ use {
|
||||
const PAGE_SIZE: usize = 4096;
|
||||
|
||||
// TODO: Make these runtime constants?
|
||||
const TOTAL_BYTES: usize = 4096 * PAGE_SIZE;
|
||||
const PASSES: usize = 2;
|
||||
const TOTAL_BYTES: usize = 262144 * PAGE_SIZE;
|
||||
const PASSES: usize = 20;
|
||||
const PASS_BYTES: usize = TOTAL_BYTES / PAGE_SIZE;
|
||||
|
||||
fn main() {
|
||||
@ -18,8 +18,8 @@ fn main() {
|
||||
|
||||
let mut thread_rng = rand::thread_rng();
|
||||
for _ in 0..PASSES {
|
||||
for idx in std::iter::from_fn(|| Some(thread_rng.gen_range(0..TOTAL_BYTES))).take(PASS_BYTES) {
|
||||
let x = &mut v[idx];
|
||||
for idx in std::iter::from_fn(|| Some(thread_rng.gen_range(0..(TOTAL_BYTES / PAGE_SIZE)))).take(PASS_BYTES) {
|
||||
let x = &mut v[PAGE_SIZE * idx];
|
||||
|
||||
// SAFETY: Target is valid for writes.
|
||||
// Note: We simply want to avoid the write being elided
|
||||
@ -28,8 +28,8 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
for idx in std::iter::from_fn(|| Some(thread_rng.gen_range(0..TOTAL_BYTES))).take(PASS_BYTES) {
|
||||
let x = &v[idx];
|
||||
for idx in std::iter::from_fn(|| Some(thread_rng.gen_range(0..(TOTAL_BYTES / PAGE_SIZE)))).take(PASS_BYTES) {
|
||||
let x = &v[PAGE_SIZE * idx];
|
||||
|
||||
// SAFETY: Target is valid for reads.
|
||||
// Note: We simply want to avoid the write being elided
|
||||
|
||||
@ -6,8 +6,8 @@ use std::{hint, ptr};
|
||||
const PAGE_SIZE: usize = 4096;
|
||||
|
||||
// TODO: Make these runtime constants?
|
||||
const TOTAL_BYTES: usize = 16384 * PAGE_SIZE;
|
||||
const PASSES: usize = 8;
|
||||
const TOTAL_BYTES: usize = 262144 * PAGE_SIZE;
|
||||
const PASSES: usize = 20;
|
||||
const PASS_STEP: usize = PAGE_SIZE;
|
||||
|
||||
fn main() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user