Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. $ head -c 8M < /dev/urandom > data_unbuf.txt
  2. $ head -c 8M < /dev/urandom > data_buf.txt
  3. $ # Write data to disk and flush caches completely
  4. $ sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
  5. 3
  6. $ cargo script posix_fadvise_test.rs
  7. Compiling posix_fadvise_test v0.1.0 (file:///home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286)
  8. 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 } }
  9. 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 } }
  10. $ # Comment out the call to advise_willneed(), flush caches again, and re-run
  11. $ sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
  12. 3
  13. $ cargo script posix_fadvise_test.rs
  14. Compiling posix_fadvise_test v0.1.0 (file:///home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286)
  15. /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
  16. /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:42 fn advise_willneed(file: &File) {
  17. /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:43 let len = file.metadata().unwrap().len();
  18. /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:44
  19. /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:45 unsafe {
  20. /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:46 assert_eq!(
  21. /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:47 libc::posix_fadvise(
  22. ...
  23. 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 } }
  24. 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 } }
  25. $ # Notice the huge increase in the duration for the advised result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement