Example #1
0
    void printMemInfo( const char * where ) {
        cout << "mem info: ";
        if ( where )
            cout << where << " ";

        ProcessInfo pi;
        if ( ! pi.supported() ) {
            cout << " not supported" << endl;
            return;
        }

        cout << "vsize: " << pi.getVirtualMemorySize() << " resident: " << pi.getResidentSize() << " mapped: " << ( MemoryMappedFile::totalMappedLength() / ( 1024 * 1024 ) ) << endl;
    }
Example #2
0
BSONObj JSGetMemInfo(const BSONObj& args, void* data) {
    ProcessInfo pi;
    uassert(10258, "processinfo not supported", pi.supported());

    BSONObjBuilder e;
    e.append("virtual", pi.getVirtualMemorySize());
    e.append("resident", pi.getResidentSize());

    BSONObjBuilder b;
    b.append("ret", e.obj());

    return b.obj();
}
Example #3
0
void printMemInfo(const char* where) {
    LogstreamBuilder out = log();
    out << "mem info: ";
    if (where)
        out << where << " ";

    ProcessInfo pi;
    if (!pi.supported()) {
        out << " not supported";
        return;
    }

    out << "vsize: " << pi.getVirtualMemorySize() << " resident: " << pi.getResidentSize()
        << " mapped: " << (MemoryMappedFile::totalMappedLength() / (1024 * 1024));
}
Example #4
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:" << connTicketHolder.used();
                 if (theReplSet) {
                     log() << " replication threads:" << 
                         ReplSetImpl::replWriterThreadCount + 
                         ReplSetImpl::replPrefetcherThreadCount;
                 }
                 last = now;
                 mlast = m;
             }
         }
     }
     catch(const std::exception&) {
         log() << "ProcessInfo exception" << endl;
     }
 }
Example #5
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;
     }
 }