Exemple #1
0
 /** called once a minute from killcursors thread */
 void sayMemoryStatus() { 
     static time_t last;
     static Mem mlast;
     try {
         ProcessInfo p;
         if ( !cmdLine.quiet && p.supported() ) {
             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;
                 }
                 last = time(0);
                 mlast = m;
             }
         }
     }
     catch(...) {
         log() << "ProcessInfo exception" << endl;
     }
 }
Exemple #2
0
 /** called once a minute from killcursors thread */
 void sayMemoryStatus() { 
     static time_t last;
     static Mem mlast;
     try {
         ProcessInfo p;
         if ( !cmdLine.quiet && p.supported() ) {
             Mem m;
             m.res = p.getResidentSize();
             m.virt = p.getVirtualMemorySize();
             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;
                 }
                 else {
                     log() << " mapped:" << totalMapped;
                 }
                 log() << " connections:" << Listener::globalTicketHolder.used();
                 if (theReplSet) {
                     log() << " replication threads:" << 
                         ReplSetImpl::replWriterThreadCount + 
                         ReplSetImpl::replPrefetcherThreadCount;
                 }
                 last = now;
                 mlast = m;
             }
         }
     }
     catch(const std::exception&) {
         log() << "ProcessInfo exception" << endl;
     }
 }
 TEST(ProcessInfo, SysInfoIsInitialized) {
     ProcessInfo processInfo;
     if (processInfo.supported()) {
         ASSERT_FALSE(processInfo.getOsType().empty());
     }
 }