本文整理汇总了C++中ProcessInfo类的典型用法代码示例。如果您正苦于以下问题:C++ ProcessInfo类的具体用法?C++ ProcessInfo怎么用?C++ ProcessInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProcessInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __declspec
__declspec(noinline) void PointerToDurableMappedFile::makeChunkWritable(size_t chunkno) {
stdx::lock_guard<stdx::mutex> lkPrivateViews(_m);
if (writable.get(chunkno)) // double check lock
return;
// remap all maps in this chunk.
// common case is a single map, but could have more than one with smallfiles or .ns files
size_t chunkStart = chunkno * MemoryMappedCOWBitset::ChunkSize;
size_t chunkNext = chunkStart + MemoryMappedCOWBitset::ChunkSize;
stdx::lock_guard<stdx::mutex> lkMapView(mapViewMutex);
map<void*, DurableMappedFile*>::iterator i = _views.upper_bound((void*)(chunkNext - 1));
while (1) {
const pair<void*, DurableMappedFile*> x = *(--i);
DurableMappedFile* mmf = x.second;
if (mmf == 0)
break;
size_t viewStart = reinterpret_cast<size_t>(x.first);
size_t viewEnd = viewStart + mmf->length();
if (viewEnd <= chunkStart)
break;
size_t protectStart = std::max(viewStart, chunkStart);
dassert(protectStart < chunkNext);
size_t protectEnd = std::min(viewEnd, chunkNext);
size_t protectSize = protectEnd - protectStart;
dassert(protectSize > 0 && protectSize <= MemoryMappedCOWBitset::ChunkSize);
DWORD oldProtection;
bool ok = VirtualProtect(
reinterpret_cast<void*>(protectStart), protectSize, PAGE_WRITECOPY, &oldProtection);
if (!ok) {
DWORD dosError = GetLastError();
if (dosError == ERROR_COMMITMENT_LIMIT) {
// System has run out of memory between physical RAM & page file, tell the user
BSONObjBuilder bb;
ProcessInfo p;
p.getExtraInfo(bb);
severe() << "MongoDB has exhausted the system memory capacity.";
severe() << "Current Memory Status: " << bb.obj();
}
severe() << "VirtualProtect for " << mmf->filename() << " chunk " << chunkno
<< " failed with " << errnoWithDescription(dosError) << " (chunk size is "
<< protectSize << ", address is " << hex << protectStart << dec << ")"
<< " in mongo::makeChunkWritable, terminating" << endl;
fassertFailed(16362);
}
}
writable.set(chunkno);
}
示例2: openDmtcpCheckpointFile
int dmtcp::CkptSerializer::openMtcpCheckpointFile(const dmtcp::string& path){
int fd = openDmtcpCheckpointFile(path);
jalib::JBinarySerializeReaderRaw rdr(path, fd);
static ConnectionToFds cfd;
static ProcessInfo pInfo;
cfd.serialize(rdr);
pInfo.serialize(rdr);
return fd;
}
示例3: ProcessInfo
void NewProcessDialog::accept()
{
ProcessInfo* info = new ProcessInfo();
info->setProcessType(static_cast<FiniteElement::ProcessType>(this->processTypeBox->currentIndex() + 1));
info->setProcessPrimaryVariable(static_cast<FiniteElement::PrimaryVariable>(this->pvTypeBox->currentIndex() + 1));
emit addProcess(info);
this->done(QDialog::Accepted);
}
示例4: DisplayMessage
logical ErrorHandle :: DisplayMessage (Error *error_obj )
{
char string[129];
char string1[10];
char buffer[sizeof(message.text)+1];
ProcessInfo *procinfo;
BEGINSEQ
if ( TestSysVariable("SUPRESS_ERRORS","YES") ) LEAVESEQ
procinfo = ThreadEntry::GetCurProcInfo();
if ( procinfo )
WriteProtocol(error_obj,procinfo->GetProtocolFile());
if ( error_obj )
message.SetData(error_obj);
if ( !gui_message )
{
if ( TestSysVariable("NO_CONSOLE_MESSAGES","YES") ) LEAVESEQ
puts(gvtxbts(buffer,message.text,StringLength(message.text,sizeof(message.text))));
LEAVESEQ
}
if ( gui_message != YES ) // temporary enabled
gui_message = NO;
#ifndef __unix__
int type = MB_OK | MB_TOPMOST;
if ( error_obj )
switch ( error_obj->type )
{
case 'D' : type = MB_OKCANCEL;
case 'M' : type |= MB_ICONQUESTION; break;
case 'S' :
case 'I' : type |= MB_ICONINFORMATION; break;
case 'W' : type |= MB_ICONWARNING; break;
default : type |= MB_ICONERROR;
}
else
type = MB_ICONERROR;
gvtxbts(string,message.component,19);
strcat(string," ");
strcat(string,gvtxbts(string1,message.error_code,4));
MessageBox(NULL, message.text, string, type);
#else if
// hier fehlt noch der XWIN-Teil
#endif
RECOVER
ENDSEQ
return(NO);
}
示例5: WriteError
void ErrorHandle :: WriteError (Error *error_obj )
{
char path[256];
Error saverr = *error_obj;
logical show_errors = NO;
ProcessInfo *procinfo;
short handle;
BEGINSEQ
if ( error_obj->CheckError() )
{
if ( (procinfo = ThreadEntry::GetCurProcInfo()) &&
procinfo->get_error_file() && *procinfo->get_error_file() )
{
strcpy(path,procinfo->get_error_file());
strcat(strcat(path,"/"),"error.lst");
}
else
strcpy(path,cpath);
show_errors = TestSysVariable("SHOW_ERRORS","YES");
*error_obj = saverr;
ILock();
if ( error_obj )
message.SetData(error_obj);
#ifdef __unix__
if ( (handle = _open (path,
(int)(O_RDWR | O_APPEND | O_CREAT ),
(S_IREAD | S_IWRITE) )) > 0 )
#else
if ( (handle = _open (path,
(int)(O_WRONLY | O_APPEND | O_CREAT | O_BINARY ),
S_IWRITE )) > 0 )
#endif
{
_write(handle,&message,sizeof(message));
_close(handle);
}
if ( show_errors )
{
if ( !gui_message )
gui_message = AUTO; // enable temporaily
ShowMessage(NULL);
}
IUnlock();
}
RECOVER
ENDSEQ
}
示例6: _path
RocksEngine::RocksEngine(const std::string& path, bool durable)
: _path(path), _durable(durable) {
{ // create block cache
uint64_t cacheSizeGB = 0;
ProcessInfo pi;
unsigned long long memSizeMB = pi.getMemSizeMB();
if (memSizeMB > 0) {
double cacheMB = memSizeMB / 2;
cacheSizeGB = static_cast<uint64_t>(cacheMB / 1024);
}
if (cacheSizeGB < 1) {
cacheSizeGB = 1;
}
_block_cache = rocksdb::NewLRUCache(cacheSizeGB * 1024 * 1024 * 1024LL);
}
// open DB
rocksdb::DB* db;
auto s = rocksdb::DB::Open(_options(), path, &db);
ROCKS_STATUS_OK(s);
_db.reset(db);
// open iterator
boost::scoped_ptr<rocksdb::Iterator> _iter(_db->NewIterator(rocksdb::ReadOptions()));
// find maxPrefix
_maxPrefix = 0;
_iter->SeekToLast();
if (_iter->Valid()) {
// otherwise the DB is empty, so we just keep it at 0
bool ok = extractPrefix(_iter->key(), &_maxPrefix);
// this is DB corruption here
invariant(ok);
}
// load ident to prefix map
{
boost::mutex::scoped_lock lk(_identPrefixMapMutex);
for (_iter->Seek(kMetadataPrefix);
_iter->Valid() && _iter->key().starts_with(kMetadataPrefix); _iter->Next()) {
rocksdb::Slice ident(_iter->key());
ident.remove_prefix(kMetadataPrefix.size());
// this could throw DBException, which then means DB corruption. We just let it fly
// to the caller
BSONObj identConfig(_iter->value().data());
BSONElement element = identConfig.getField("prefix");
// TODO: SERVER-16979 Correctly handle errors returned by RocksDB
// This is DB corruption
invariant(!element.eoo() || !element.isNumber());
uint32_t identPrefix = static_cast<uint32_t>(element.numberInt());
_identPrefixMap[StringData(ident.data(), ident.size())] = identPrefix;
}
}
}
示例7: 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;
}
示例8: 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();
}
示例9: serialize
void ClientMetadata::serialize(StringData driverName,
StringData driverVersion,
BSONObjBuilder* builder) {
ProcessInfo processInfo;
serializePrivate(driverName,
driverVersion,
processInfo.getOsType(),
processInfo.getOsName(),
processInfo.getArch(),
processInfo.getOsVersion(),
builder);
}
示例10: 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));
}
示例11: serverBob
// static
void Explain::generateServerInfo(BSONObjBuilder* out) {
BSONObjBuilder serverBob(out->subobjStart("serverInfo"));
out->append("host", getHostNameCached());
out->appendNumber("port", serverGlobalParams.port);
out->append("version", versionString);
out->append("gitVersion", gitVersion());
ProcessInfo p;
BSONObjBuilder bOs;
bOs.append("type", p.getOsType());
bOs.append("name", p.getOsName());
bOs.append("version", p.getOsVersion());
serverBob.append(StringData("os"), bOs.obj());
serverBob.doneFast();
}
示例12: GetGeometry
//************************************************************************************
//************************************************************************************
void ThermalFace2D::CalculateAll(MatrixType& rLeftHandSideMatrix, VectorType& rRightHandSideVector, ProcessInfo& rCurrentProcessInfo, bool CalculateStiffnessMatrixFlag, bool CalculateResidualVectorFlag)
{
KRATOS_TRY
unsigned int number_of_nodes = GetGeometry().size();
//resizing as needed the LHS
unsigned int MatSize=number_of_nodes;
ConvectionDiffusionSettings::Pointer my_settings = rCurrentProcessInfo.GetValue(CONVECTION_DIFFUSION_SETTINGS);
const Variable<double>& rUnknownVar = my_settings->GetUnknownVariable();
const Variable<double>& rSurfaceSourceVar = my_settings->GetSurfaceSourceVariable();
//calculate lenght
double x21 = GetGeometry()[1].X() - GetGeometry()[0].X();
double y21 = GetGeometry()[1].Y() - GetGeometry()[0].Y();
double lenght = x21*x21 + y21*y21;
lenght = sqrt(lenght);
const Properties& ConstProp = GetProperties();
const double& ambient_temperature = ConstProp[AMBIENT_TEMPERATURE];
double StefenBoltzmann = 5.67e-8;
double emissivity = ConstProp[EMISSIVITY];
double convection_coefficient = ConstProp[CONVECTION_COEFFICIENT];
const double& T0 = GetGeometry()[0].FastGetSolutionStepValue(rUnknownVar);
const double& T1 = GetGeometry()[1].FastGetSolutionStepValue(rUnknownVar);
const double& q0 =GetGeometry()[0].FastGetSolutionStepValue(rSurfaceSourceVar);
const double& q1 =GetGeometry()[1].FastGetSolutionStepValue(rSurfaceSourceVar);
if (CalculateStiffnessMatrixFlag == true) //calculation of the matrix is required
{
if(rLeftHandSideMatrix.size1() != MatSize )
rLeftHandSideMatrix.resize(MatSize,MatSize,false);
noalias(rLeftHandSideMatrix) = ZeroMatrix(MatSize,MatSize);
rLeftHandSideMatrix(0,0) = ( convection_coefficient + emissivity*StefenBoltzmann*4.0*pow(T0,3) )* 0.5 * lenght;
rLeftHandSideMatrix(1,1) = ( convection_coefficient + emissivity*StefenBoltzmann*4.0*pow(T1,3) )* 0.5 * lenght;
}
//resizing as needed the RHS
double aux = pow(ambient_temperature,4);
if (CalculateResidualVectorFlag == true) //calculation of the matrix is required
{
if(rRightHandSideVector.size() != MatSize )
rRightHandSideVector.resize(MatSize,false);
rRightHandSideVector[0] = q0 - emissivity*StefenBoltzmann*(pow(T0,4) - aux) - convection_coefficient * ( T0 - ambient_temperature);
rRightHandSideVector[1] = q1 - emissivity*StefenBoltzmann*(pow(T1,4) - aux) - convection_coefficient * ( T1 - ambient_temperature);
rRightHandSideVector *= 0.5*lenght;
}
KRATOS_CATCH("")
}
示例13: getCacheSizeMB
size_t WiredTigerUtil::getCacheSizeMB(double requestedCacheSizeGB) {
double cacheSizeMB;
const double kMaxSizeCacheMB = 10 * 1000 * 1000;
if (requestedCacheSizeGB == 0) {
// Choose a reasonable amount of cache when not explicitly specified by user.
// Set a minimum of 256MB, otherwise use 50% of available memory over 1GB.
ProcessInfo pi;
double memSizeMB = pi.getMemSizeMB();
cacheSizeMB = std::max((memSizeMB - 1024) * 0.5, 256.0);
} else {
cacheSizeMB = 1024 * requestedCacheSizeGB;
}
if (cacheSizeMB > kMaxSizeCacheMB) {
log() << "Requested cache size: " << cacheSizeMB << "MB exceeds max; setting to "
<< kMaxSizeCacheMB << "MB";
cacheSizeMB = kMaxSizeCacheMB;
}
return static_cast<size_t>(cacheSizeMB);
}
示例14:
//************************************************************************************
//************************************************************************************
void ThermalFace2D::GetDofList(DofsVectorType& ConditionalDofList,ProcessInfo& CurrentProcessInfo)
{
ConvectionDiffusionSettings::Pointer my_settings = CurrentProcessInfo.GetValue(CONVECTION_DIFFUSION_SETTINGS);
const Variable<double>& rUnknownVar = my_settings->GetUnknownVariable();
ConditionalDofList.resize(GetGeometry().size());
for (unsigned int i=0; i<GetGeometry().size(); i++)
{
ConditionalDofList[i] = (GetGeometry()[i].pGetDof(rUnknownVar));
}
}
示例15: run
bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
ProcessInfo p;
BSONObjBuilder bSys, bOs;
bSys.appendDate( "currentTime" , jsTime() );
bSys.append( "hostname" , prettyHostName() );
bSys.append( "cpuAddrSize", p.getAddrSize() );
bSys.append( "memSizeMB", static_cast <unsigned>( p.getMemSizeMB() ) );
bSys.append( "numCores", p.getNumCores() );
bSys.append( "cpuArch", p.getArch() );
bSys.append( "numaEnabled", p.hasNumaEnabled() );
bOs.append( "type", p.getOsType() );
bOs.append( "name", p.getOsName() );
bOs.append( "version", p.getOsVersion() );
result.append( StringData( "system" ), bSys.obj() );
result.append( StringData( "os" ), bOs.obj() );
p.appendSystemDetails( result );
return true;
}