fn bench_random(ratio: f64) {
    let num_runs = 5;
    let freelist = FreeList::new(0, 32768, true)
        .align(32)
        .policy(Policy::First);
    let mut results_vec = Vec::new();
    for _ in 0..num_runs {
        results_vec.push(workloads::random_memory(freelist.clone(), ratio));
    }

    println!("Random size allocation with {}% malloc\n", ratio * 100.0);
    println!("Free list results");
    print_results(results_vec);
    println!();

    let buddy = BuddyAllocator::new(5, 15);
    let mut results_vec = Vec::new();
    for _ in 0..num_runs {
        results_vec.push(workloads::random_memory(buddy.clone(), ratio));
    }

    println!("Buddy allocator results");
    print_results(results_vec);
}
// Benches take the average of 5 runs
Benches take the average of 5 runs
Benches take the average of 5 runs
fn bench_random(ratio: f64) {
    let num_runs = 5;
    let freelist = FreeList::new(0, 32768, true)
        .align(32)
        .policy(Policy::First);
    let mut results_vec = Vec::new();
    for _ in 0..num_runs {
        results_vec.push(workloads::random_memory(freelist.clone(), ratio));
    }
    println!("Random size allocation with {}% malloc\n", ratio * 100.0);
    println!("Free list results");
    print_results(results_vec);
    println!();
    let buddy = BuddyAllocator::new(5, 15);
    let mut results_vec = Vec::new();
    for _ in 0..num_runs {
        results_vec.push(workloads::random_memory(buddy.clone(), ratio));
    }
    println!("Buddy allocator results");
    print_results(results_vec);
}
fn bench_random ( ratio : f64 ) { let num_runs = 5 ; let freelist = FreeList :: new ( 0 , 32768 , true ) . align ( 32 ) . policy ( Policy :: First ) ; let mut results_vec = Vec :: new ( ) ; for _ in 0 .. num_runs { results_vec . push ( workloads :: random_memory ( freelist . clone ( ) , ratio ) ) ; } println ! ( " \n " ratio 100.0 ) ; println ! ( " " ) ; print_results ( results_vec ) ; println ! ( ) ; let buddy = BuddyAllocator :: new ( 5 , 15 ) ; let mut results_vec = Vec :: new ( ) ; for _ in 0 .. num_runs { results_vec . push ( workloads :: random_memory ( buddy . clone ( ) , ratio ) ) ; } println ! ( " " ) ; print_results ( results_vec ) ; }
Benches take the average of 5 runs
Benches take the average of 5 runs
ratio
f64
ratio
f64