3
#include "../util/goodies.h"
8
#if defined(F_FULLFSYNC)
10
fcntl( f, F_FULLFSYNC );
13
void fullsync(int f) {
18
int main(int argc, char* argv[], char *envp[] ) {
19
cout << "hello" << endl;
21
FILE *f = fopen("/data/db/temptest", "a");
24
cout << "can't open file\n";
30
for ( int i = 0; i < 50000; i++ )
31
fwrite("abc", 3, 1, f);
32
cout << "small writes: " << t.millis() << "ms" << endl;
37
for ( int i = 0; i < 10000; i++ ) {
38
fwrite("abc", 3, 1, f);
43
cout << "flush: " << ms << "ms, " << ms / 10000.0 << "ms/request" << endl;
48
for ( int i = 0; i < 500; i++ ) {
49
fwrite("abc", 3, 1, f);
54
int ms = t.millis() - 500 * 2;
55
cout << "flush with sleeps: " << ms << "ms, " << ms / 500.0 << "ms/request" << endl;
59
for ( int pass = 0; pass < 2; pass++ ) {
60
cout << "pass " << pass << endl;
64
for ( int i = 0; i < n; i++ ) {
66
fwrite("abc", 3, 1, f);
68
fwrite(buf, 8192, 1, f);
74
cout << "fullsync: " << ms << "ms, " << ms / ((double) n) << "ms/request" << endl;
79
for ( int i = 0; i < 500; i++ ) {
81
fwrite("abc", 3, 1, f);
83
fwrite(buf, 8192, 1, f);
89
int ms = t.millis() - 2 * 500;
90
cout << "fullsync with sleeps: " << ms << "ms, " << ms / 500.0 << "ms/request" << endl;
97
/* try from beginning of the file, where we aren't appending and changing the file length,
98
to see if this is faster as the directory entry then doesn't have to be flushed (if noatime in effect).
100
f = fopen("/data/db/temptest", "r+");
103
for ( int i = 0; i < n; i++ ) {
104
fwrite("xyz", 3, 1, f);
109
cout << "fullsync without growing: " << ms << "ms, " << ms / ((double) n) << "ms/request" << endl;
112
// without growing, with delay
115
/* try from beginning of the file, where we aren't appending and changing the file length,
116
to see if this is faster as the directory entry then doesn't have to be flushed (if noatime in effect).
118
f = fopen("/data/db/temptest", "r+");
121
for ( int i = 0; i < n; i++ ) {
122
fwrite("xyz", 3, 1, f);
127
int ms = t.millis() - 2 * 500;
128
cout << "fullsync without growing with sleeps: " << ms << "ms, " << ms / ((double) n) << "ms/request" << endl;