diff options
author | Antonin Kral <a.kral@bobek.cz> | 2011-03-17 00:07:52 +0100 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2011-03-17 00:07:52 +0100 |
commit | 98b8b639326ab4c89eed73739d9903993c4c8959 (patch) | |
tree | 0462df078bf740093774d033b75f0ea24a31fa97 /util/processinfo_darwin.cpp | |
parent | f5d6e97ca8d2f3e7c4cdd5c9afbf8e756ef65bc2 (diff) | |
parent | 582fc32574a3b158c81e49cb00e6ae59205e66ba (diff) | |
download | mongodb-98b8b639326ab4c89eed73739d9903993c4c8959.tar.gz |
Merge commit 'upstream/1.8.0
Diffstat (limited to 'util/processinfo_darwin.cpp')
-rw-r--r-- | util/processinfo_darwin.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/util/processinfo_darwin.cpp b/util/processinfo_darwin.cpp index cb54bed..c1190ae 100644 --- a/util/processinfo_darwin.cpp +++ b/util/processinfo_darwin.cpp @@ -36,58 +36,58 @@ using namespace std; namespace mongo { - - ProcessInfo::ProcessInfo( pid_t pid ) : _pid( pid ){ + + ProcessInfo::ProcessInfo( pid_t pid ) : _pid( pid ) { } - ProcessInfo::~ProcessInfo(){ + ProcessInfo::~ProcessInfo() { } - bool ProcessInfo::supported(){ + bool ProcessInfo::supported() { return true; } - - int ProcessInfo::getVirtualMemorySize(){ + + int ProcessInfo::getVirtualMemorySize() { task_t result; - + mach_port_t task; - - if ( ( result = task_for_pid( mach_task_self() , _pid , &task) ) != KERN_SUCCESS ){ + + if ( ( result = task_for_pid( mach_task_self() , _pid , &task) ) != KERN_SUCCESS ) { cout << "error getting task\n"; return 0; } - + #if !defined(__LP64__) task_basic_info_32 ti; #else task_basic_info_64 ti; #endif mach_msg_type_number_t count = TASK_BASIC_INFO_COUNT; - if ( ( result = task_info( task , TASK_BASIC_INFO , (task_info_t)&ti, &count ) ) != KERN_SUCCESS ){ + if ( ( result = task_info( task , TASK_BASIC_INFO , (task_info_t)&ti, &count ) ) != KERN_SUCCESS ) { cout << "error getting task_info: " << result << endl; return 0; } return (int)((double)ti.virtual_size / (1024.0 * 1024 ) ); } - - int ProcessInfo::getResidentSize(){ + + int ProcessInfo::getResidentSize() { task_t result; - + mach_port_t task; - - if ( ( result = task_for_pid( mach_task_self() , _pid , &task) ) != KERN_SUCCESS ){ + + if ( ( result = task_for_pid( mach_task_self() , _pid , &task) ) != KERN_SUCCESS ) { cout << "error getting task\n"; return 0; } - - + + #if !defined(__LP64__) task_basic_info_32 ti; #else task_basic_info_64 ti; #endif mach_msg_type_number_t count = TASK_BASIC_INFO_COUNT; - if ( ( result = task_info( task , TASK_BASIC_INFO , (task_info_t)&ti, &count ) ) != KERN_SUCCESS ){ + if ( ( result = task_info( task , TASK_BASIC_INFO , (task_info_t)&ti, &count ) ) != KERN_SUCCESS ) { cout << "error getting task_info: " << result << endl; return 0; } @@ -96,18 +96,18 @@ namespace mongo { void ProcessInfo::getExtraInfo(BSONObjBuilder& info) {} - bool ProcessInfo::blockCheckSupported(){ + bool ProcessInfo::blockCheckSupported() { return true; } - - bool ProcessInfo::blockInMemory( char * start ){ + + bool ProcessInfo::blockInMemory( char * start ) { static long pageSize = 0; - if ( pageSize == 0 ){ + if ( pageSize == 0 ) { pageSize = sysconf( _SC_PAGESIZE ); } start = start - ( (unsigned long long)start % pageSize ); char x = 0; - if ( mincore( start , 128 , &x ) ){ + if ( mincore( start , 128 , &x ) ) { log() << "mincore failed: " << errnoWithDescription() << endl; return 1; } |