Skip to content

Instantly share code, notes, and snippets.

View MrCroxx's full-sized avatar
🦀
A fresh Rustacean.

Croxx MrCroxx

🦀
A fresh Rustacean.
View GitHub Profile
@MrCroxx
MrCroxx / commands_and_output.txt
Created May 25, 2022 08:40 — forked from abonander/commands_and_output.txt
Test of `posix_fadvise()` for Rust
$ # Generate 8 MB of random data
$ head -c 8M < /dev/urandom > data.txt
$ # Flush and clear the cache so we get the data from disk
$ sync && echo 3 | sudo tee /proc/sys/vm/drop_caches && cargo script posix_fadvise_test.rs
3
Compiling posix_fadvise_test v0.1.0 (file:///home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286)
Advised result: HashResult { hash: [173, 168, 157, 204, 185, 126, 165, 177, 195, 111, 94, 179, 252, 59, 25, 169], time: Duration { secs: 0, nanos: 10050785 } }
$ # Comment out the call to advise_willneed, save, flush again and re-run
$ sync && echo 3 | sudo tee /proc/sys/vm/drop_caches && cargo script posix_fadvise_test.rs
3
#!/bin/bash
set -ueo pipefail
TEST_DIR=$1
echo "benchmark disk mounted on" $TEST_DIR
echo "--> write throughput"
sudo fio --name=disk_benchmark --directory=$TEST_DIR --numjobs=8 \
--size=10G --time_based --runtime=60s --ramp_time=2s --ioengine=libaio \