本文整理汇总了C++中ProcessInfo::getResidentSize方法的典型用法代码示例。如果您正苦于以下问题:C++ ProcessInfo::getResidentSize方法的具体用法?C++ ProcessInfo::getResidentSize怎么用?C++ ProcessInfo::getResidentSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProcessInfo
的用法示例。
在下文中一共展示了ProcessInfo::getResidentSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printMemInfo
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;
}
示例2: JSGetMemInfo
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();
}
示例3: printMemInfo
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));
}
示例4: sayMemoryStatus
/** 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;
}
}
示例5: sayMemoryStatus
/** 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;
}
}