Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ head -c 8M < /dev/urandom > data_unbuf.txt
- $ head -c 8M < /dev/urandom > data_buf.txt
- $ # Write data to disk and flush caches completely
- $ sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
- 3
- $ cargo script posix_fadvise_test.rs
- Compiling posix_fadvise_test v0.1.0 (file:///home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286)
- Unadvised result: HashResult { hash: [0, 42, 55, 246, 0, 0, 18, 138, 140, 13, 45, 185, 239, 203, 220, 112], time: Duration { secs: 0, nanos: 26310368 } }
- Advised result: HashResult { hash: [225, 161, 142, 219, 14, 193, 119, 103, 106, 26, 140, 250, 238, 212, 83, 168], time: Duration { secs: 0, nanos: 3485998 } }
- $ # Comment out the call to advise_willneed(), flush caches again, and re-run
- $ sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
- 3
- $ cargo script posix_fadvise_test.rs
- Compiling posix_fadvise_test v0.1.0 (file:///home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286)
- /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:42:1: 55:2 warning: function is never used: `advise_willneed`, #[warn(dead_code)] on by default
- /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:42 fn advise_willneed(file: &File) {
- /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:43 let len = file.metadata().unwrap().len();
- /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:44
- /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:45 unsafe {
- /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:46 assert_eq!(
- /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:47 libc::posix_fadvise(
- ...
- Unadvised result: HashResult { hash: [0, 42, 55, 246, 0, 0, 18, 138, 140, 13, 45, 185, 239, 203, 220, 112], time: Duration { secs: 0, nanos: 27309768 } }
- Advised result: HashResult { hash: [225, 161, 142, 219, 14, 193, 119, 103, 106, 26, 140, 250, 238, 212, 83, 168], time: Duration { secs: 0, nanos: 19609183 } }
- $ # Notice the huge increase in the duration for the advised result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement