From 8c35ccfba6d1b68770613322046e4724b54d83ab Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Sat, 3 Jan 2009 13:01:29 -0500 Subject: [PATCH] fsync --- db/flushtest.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db/flushtest.cpp b/db/flushtest.cpp index 614550be7fa..a0e5d37f2b7 100644 --- a/db/flushtest.cpp +++ b/db/flushtest.cpp @@ -24,12 +24,13 @@ int main(int argc, char* argv[], char *envp[] ) { fwrite("abc", 3, 1, f); cout << "small writes: " << t.millis() << "ms" << endl; } - + { Timer t; for( int i = 0; i < 50000; i++ ) { fwrite("abc", 3, 1, f); fflush(f); + fsync( fileno( f ) ); } cout << "flush: " << t.millis() << "ms" << endl; } @@ -39,10 +40,11 @@ int main(int argc, char* argv[], char *envp[] ) { for( int i = 0; i < 500; i++ ) { fwrite("abc", 3, 1, f); fflush(f); + fsync( fileno( f ) ); sleepmillis(10); } cout << "flush with 5000 sleep: " << t.millis() << "ms" << endl; } - + return 0; }