diff options
author | Eric Milkie <milkie@10gen.com> | 2012-06-20 13:43:56 -0400 |
---|---|---|
committer | Eric Milkie <milkie@10gen.com> | 2012-06-22 13:41:46 -0400 |
commit | 64f1404354f65247efdf9fd23aa178cf274f8af8 (patch) | |
tree | b060979c4e4a9525541ca74c1081c887ec7198da /src/mongo/db/clientcursor.cpp | |
parent | 3444ed0ab80db73704002cb44c9aa3f90fdaa253 (diff) | |
download | mongo-64f1404354f65247efdf9fd23aa178cf274f8af8.tar.gz |
move memory leak stats into clientcursormon
Diffstat (limited to 'src/mongo/db/clientcursor.cpp')
-rw-r--r-- | src/mongo/db/clientcursor.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp index 3f1fc3143d3..7d7e5d85b22 100644 --- a/src/mongo/db/clientcursor.cpp +++ b/src/mongo/db/clientcursor.cpp @@ -34,6 +34,7 @@ #include "mongo/client/dbclientinterface.h" #include "mongo/db/scanandorder.h" #include "pagefault.h" +#include "mongo/db/repl/rs.h" namespace mongo { @@ -694,9 +695,9 @@ namespace mongo { struct Mem { Mem() { res = virt = mapped = 0; } - int res; - int virt; - int mapped; + long long res; + long long virt; + long long mapped; bool grew(const Mem& r) { return (r.res && (((double)res)/r.res)>1.1 ) || (r.virt && (((double)virt)/r.virt)>1.1 ) || @@ -714,18 +715,30 @@ namespace mongo { Mem m; m.res = p.getResidentSize(); m.virt = p.getVirtualMemorySize(); - m.mapped = (int) (MemoryMappedFile::totalMappedLength() / ( 1024 * 1024 )); - if( time(0)-last >= 300 || m.grew(mlast) ) { - log() << "mem (MB) res:" << m.res << " virt:" << m.virt << " mapped:" << m.mapped << endl; - if( m.virt - (cmdLine.dur?2:1)*m.mapped > 5000 ) { - ONCE log() << "warning virtual/mapped memory differential is large. journaling:" << cmdLine.dur << endl; + m.mapped = MemoryMappedFile::totalMappedLength() / (1024 * 1024); + time_t now = time(0); + if( now - last >= 300 || m.grew(mlast) ) { + log() << "mem (MB) res:" << m.res << " virt:" << m.virt; + long long totalMapped = m.mapped; + if (cmdLine.dur) { + totalMapped *= 2; + log() << " mapped (incl journal view):" << totalMapped; } - last = time(0); + else { + log() << " mapped:" << totalMapped; + } + log() << " connections:" << connTicketHolder.used(); + if (theReplSet) { + log() << " replication threads:" << + ReplSetImpl::replWriterThreadCount + + ReplSetImpl::replPrefetcherThreadCount; + } + last = now; mlast = m; } } } - catch(...) { + catch(const std::exception&) { log() << "ProcessInfo exception" << endl; } } |