diff --git a/client/examples/mongoperf.cpp b/client/examples/mongoperf.cpp index 918820c9272..4ec18b12d31 100644 --- a/client/examples/mongoperf.cpp +++ b/client/examples/mongoperf.cpp @@ -1,7 +1,7 @@ /* How to build and run: - g++ -o mongoperf -I .. mongoperf.cpp mongo_client_lib.cpp -lboost_thread-mt -lboost_filesystem + (out of date) : g++ -o mongoperf -I .. mongoperf.cpp mongo_client_lib.cpp -lboost_thread-mt -lboost_filesystem */ #include @@ -23,7 +23,7 @@ bo options; unsigned long long len; // file len const unsigned PG = 4096; unsigned nThreadsRunning = 0; - +char *mmf = 0; AtomicUInt writes; void writer() { @@ -42,12 +42,14 @@ void writer() { } void go() { + MemoryMappedFile f; cout << "create test file" << endl; len = options["fileSizeMB"].numberLong(); if( len == 0 ) len = 1; cout << "test fileSizeMB : " << len << endl; len *= 1024 * 1024; - lf = new LogFile("mongoperf__testfile__tmp"); + const char *fname = "mongoperf__testfile__tmp"; + lf = new LogFile(fname); const unsigned sz = 1024 * 256; char buf[sz]; for( unsigned i = 0; i < len; i+= sz ) { @@ -57,6 +59,11 @@ void go() { //void *p = m.create("mongoperf__testfile__tmp", len * 1024 * 1024, true); //assert(p); + if( o["mmf"].trueValue() ) { + mmf = f.map(fname); + assert( mmf ); + } + cout << "testing..."<< endl; BSONObj& o = options; @@ -101,6 +108,7 @@ int main(int argc, char *argv[]) { " fileSizeMB: test file size. if the file is small the heads will not move much\n" " thus making the test not informative.\n" " sleepMicros: pause for sleepMicros/#threadsrunning between each operation\n" + " mmf:true do i/o's via memory mapped files\n" << endl; return 0; } diff --git a/client/examples/mongoperf.vcxproj b/client/examples/mongoperf.vcxproj index 703f1f3d69c..89168370733 100755 --- a/client/examples/mongoperf.vcxproj +++ b/client/examples/mongoperf.vcxproj @@ -91,6 +91,19 @@ + + + + + + + + + + + + +