2009-02-20 15:34:25 +01:00
|
|
|
// processinfo.h
|
|
|
|
|
2009-10-27 20:58:27 +01:00
|
|
|
/* Copyright 2009 10gen Inc.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2009-02-20 15:34:25 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
2009-02-20 21:23:14 +01:00
|
|
|
|
|
|
|
#ifndef _WIN32
|
2009-02-20 15:34:25 +01:00
|
|
|
#include <unistd.h>
|
2009-02-20 21:23:14 +01:00
|
|
|
#else
|
|
|
|
typedef int pid_t;
|
|
|
|
int getpid();
|
|
|
|
#endif
|
2009-02-20 15:34:25 +01:00
|
|
|
|
|
|
|
namespace mongo {
|
2010-01-15 23:53:33 +01:00
|
|
|
|
|
|
|
class BSONObjBuilder;
|
2009-02-20 15:34:25 +01:00
|
|
|
|
|
|
|
class ProcessInfo {
|
|
|
|
public:
|
|
|
|
ProcessInfo( pid_t pid = getpid() );
|
|
|
|
~ProcessInfo();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mbytes
|
|
|
|
*/
|
|
|
|
int getVirtualMemorySize();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mbytes
|
|
|
|
*/
|
|
|
|
int getResidentSize();
|
2010-01-15 23:53:33 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Append platform-specific data to obj
|
|
|
|
*/
|
|
|
|
void getExtraInfo(BSONObjBuilder& info);
|
2009-02-20 15:34:25 +01:00
|
|
|
|
|
|
|
bool supported();
|
|
|
|
|
2010-01-28 20:14:33 +01:00
|
|
|
bool blockCheckSupported();
|
|
|
|
bool blockInMemory( char * start );
|
|
|
|
|
2009-02-20 15:34:25 +01:00
|
|
|
private:
|
|
|
|
pid_t _pid;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|