Permalink
Browse files

MemoryMappedFile::getTotalMapped

  • Loading branch information...
1 parent 283572b commit b733978054f7b2cc2505e7a7e554d00b1f471663 @erh erh committed Oct 7, 2009
Showing with 15 additions and 3 deletions.
  1. +9 −0 util/mmap.cpp
  2. +6 −3 util/mmap.h
View
@@ -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;
View
@@ -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();

0 comments on commit b733978

Please sign in to comment.