Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added file.sync_data() so the time reported is more accurate #1

Merged
merged 4 commits into from Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 27 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,13 @@ fn write_once(buffer: &[u8]) -> std::io::Result<Duration> {
let mut file = File::create("test").expect("Can't open test file");

for _ in 0..TOTAL_SIZE_MB / BUF_SIZE_MB {
write_time += prof! {
// make sure the data is synced with the disk as the kernel performs
// write buffering
//
// TODO Open the file in O_DSYNC instead to avoid the additional syscall
write_time += prof!{
file.write_all(buffer)?;
file.sync_data()?;
};
print!(".");
This conversation was marked as resolved.
Show resolved Hide resolved
stdout().flush()?;
Expand Down