diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-10-07 12:42:43 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-10-07 12:42:43 -0400 |
commit | b733978054f7b2cc2505e7a7e554d00b1f471663 (patch) | |
tree | 6c5664397acb26d22b7029e2c9495281f1d82ea3 /util | |
parent | 283572bebc03fb6b89a50430c7720377e12f9d5c (diff) | |
download | mongo-b733978054f7b2cc2505e7a7e554d00b1f471663.tar.gz |
MemoryMappedFile::getTotalMapped
Diffstat (limited to 'util')
-rw-r--r-- | util/mmap.cpp | 9 | ||||
-rw-r--r-- | util/mmap.h | 9 |
2 files changed, 15 insertions, 3 deletions
diff --git a/util/mmap.cpp b/util/mmap.cpp index 5c571cc87a7..7d6b1d0b558 100644 --- a/util/mmap.cpp +++ b/util/mmap.cpp @@ -49,6 +49,15 @@ namespace mongo { --closingAllFiles; } + long long MemoryMappedFile::totalMappedLength(){ + unsigned long long total = 0; + + for ( set<MemoryMappedFile*>::iterator i = mmfiles.begin(); i != mmfiles.end(); i++ ) + total += (*i)->length(); + + return total; + } + void MemoryMappedFile::updateLength( const char *filename, long &length ) { if ( !boost::filesystem::exists( filename ) ) return; diff --git a/util/mmap.h b/util/mmap.h index 810dd4fb2f5..64eb2d4b18a 100644 --- a/util/mmap.h +++ b/util/mmap.h @@ -22,11 +22,11 @@ namespace mongo { class MemoryMappedFile { public: - static void closeAllFiles( stringstream &message ); + MemoryMappedFile(); ~MemoryMappedFile(); /* closes the file if open */ void close(); - + // Throws exception if file doesn't exist. void* map( const char *filename ); @@ -46,7 +46,10 @@ namespace mongo { } static void updateLength( const char *filename, long &length ); - + + static long long totalMappedLength(); + static void closeAllFiles( stringstream &message ); + private: void created(); |