#include <ncbi_pch.hpp>
#include <windows.h>
#include <crtdbg.h>
#include <stdlib.h>
#include <corelib/ncbimtx.hpp>
#include <corelib/ncbi_system.hpp>
#include <corelib/ncbi_safe_static.hpp>
#include <corelib/error_codes.hpp>
#include <corelib/ncbierror.hpp>
#include "ncbisys.hpp"
#include <array>
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/times.h>
#include <sys/types.h>
#include <dirent.h>
#include <limits.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#include "ncbi_os_unix_p.hpp"
#include <signal.h>
#include <corelib/ncbidll.hpp>
#include "ncbi_os_mswin_p.hpp"
#include <dbghelp.h>
#include <intrin.h>
Go to the source code of this file.
Go to the SVN repository for this file.
static void s_DefaultPrintHandler (void) static void s_HandlerGuard (void) static void s_SignalHandler (int sig) DEFINE_STATIC_FAST_MUTEX (s_Limits_Handler_Mutex) static void s_SetPrintHandler (TLimitsPrintHandler handler, TLimitsPrintParameter parameter) static void s_NewHandler (void) bool SetMemoryLimit (size_t max_size, TLimitsPrintHandler handler, TLimitsPrintParameter parameter) [UNIX only] Set memory limit. More...Definition at line 48 of file ncbi_system.cpp.
◆ USE_SETCPULIMIT ◆ USE_SETLIMITS ◆ USE_SETMEMLIMIT ◆ _SEH_Handler() ◆ DEFINE_STATIC_FAST_MUTEX() DEFINE_STATIC_FAST_MUTEX ( s_Limits_Handler_Mutex ) ◆ DisableSuppressSystemMessageBox() void DisableSuppressSystemMessageBox ( ) ◆ GetCurrentProcessTimes() bool GetCurrentProcessTimes ( double * user_time, double * system_time ) ◆ GetMemoryUsage() bool GetMemoryUsage ( size_t * total, size_t * resident, size_t * shared )Definition at line 926 of file ncbi_system.cpp.
References BOOL, CDll::eAutoUnload, CDll::eLoadNow, CNcbiError::eNotSupported, FAR, CDll::GetEntryPoint_Func(), CFile::GetLength(), CSystemInfo::GetVirtualMemoryPageSize(), HANDLE, len, CNcbiError::Set(), ncbi::grid::netcache::search::fields::size, and t.
Referenced by CCurrentProcess::GetMemoryUsage(), and CProcess::GetMemoryUsage().
◆ GetProcessFDCount() int GetProcessFDCount ( int * soft_limit, int * hard_limit ) ◆ GetProcessThreadCount() int GetProcessThreadCount ( void ) ◆ GetVirtualMemoryLimitHard() size_t GetVirtualMemoryLimitHard ( void )[UNIX only] Get "hard" memory limit of the virtual memory (address space) in bytes for a current process.
Definition at line 453 of file ncbi_system.cpp.
References CNcbiError::eNotSupported, CNcbiError::Set(), and CNcbiError::SetFromErrno().
◆ GetVirtualMemoryLimitSoft() size_t GetVirtualMemoryLimitSoft ( void )[UNIX only] Get "soft" memory limit of the virtual memory (address space) in bytes for a current process.
Definition at line 434 of file ncbi_system.cpp.
References CNcbiError::eNotSupported, CNcbiError::Set(), and CNcbiError::SetFromErrno().
◆ IsSuppressedDebugSystemMessageBox() bool IsSuppressedDebugSystemMessageBox ( ) ◆ MemoryAdvise()[UNIX only] Advise on memory usage for specified memory region.
Definition at line 1188 of file ncbi_system.cpp.
References _T_STDSTRING, _TROUBLE, CNcbiError::eBadAddress, eMADV_DoFork, eMADV_DontFork, eMADV_DontNeed, eMADV_Mergeable, eMADV_Normal, eMADV_Random, eMADV_Sequential, eMADV_Unmergeable, eMADV_WillNeed, CNcbiError::eNotSupported, ERR_POST_X, ERR_POST_X_ONCE, len, NcbiSys_strerror, CNcbiError::Set(), CNcbiError::SetErrno(), and Warning().
Referenced by CMemoryFile_Base::MemMapAdviseAddr().
◆ s_DefaultPrintHandler() static void s_DefaultPrintHandler ( void ) static ◆ s_HandlerGuard() static void s_HandlerGuard ( void ) staticDefinition at line 201 of file ncbi_system.cpp.
References eLEC_Cpu, eLEC_Memory, s_CpuTimeLimit, s_DefaultPrintHandler(), s_IsHandlerActive, s_MemoryLimitSoft, s_PrintHandler, s_PrintHandlerParam, s_Reason, s_ReservedMemory, and s_TimeSet.
Referenced by s_NewHandler(), and s_SignalHandler().
◆ s_NewHandler() static void s_NewHandler ( void ) static ◆ s_SetPrintHandler() ◆ s_SignalHandler() ◆ SetCpuTimeLimit()[UNIX only] Set CPU time usage limit.
Set the limit for the CPU time that can be consumed by current process.
Definition at line 534 of file ncbi_system.cpp.
References s_CpuTimeLimit, s_SetPrintHandler(), and s_SignalHandler().
Referenced by CNcbiApplicationAPI::x_HonorStandardSettings().
◆ SetMemoryLimit()[UNIX only] Set memory limit.
Set the limit for the size of used memory allocated by the process.
Definition at line 282 of file ncbi_system.cpp.
References s_MemoryLimitHard, s_MemoryLimitSoft, s_NewHandler(), s_SetPrintHandler(), and CNcbiError::SetFromErrno().
Referenced by CNcbiApplicationAPI::x_HonorStandardSettings().
◆ SetMemoryLimitHard() ◆ SetMemoryLimitSoft() ◆ SleepMicroSec() ◆ SleepMilliSec()Definition at line 1323 of file ncbi_system.cpp.
References kMicroSecondsPerSecond, kMilliSecondsPerSecond, and SleepMicroSec().
Referenced by CEutilsClient::CallWithRetry(), CPSGDataLoader_Impl::CallWithRetry(), CallWithRetry(), CCSRADataLoader_Impl::CallWithRetry(), CSNPDataLoader_Impl::CallWithRetry(), CVDBGraphDataLoader_Impl::CallWithRetry(), CWGSDataLoader_Impl::CallWithRetry(), CGridCommandLineInterfaceApp::Cmd_Suspend(), SNetServerImpl::ConnectAndExec(), CBamUtils::CreateCoverageGraphs(), CServiceDiscovery::DiscoverImpl(), CLockVectorGuard< TLockVect >::DoLock(), CPipe::ExecWait(), CTestThread::GlobalSyncPoint(), SNetServiceImpl::IterateUntilExecOK(), CProcess::Kill(), CProcess::KillGroupById(), CNamedPipeHandle::Listen(), CInterProcessLock::Lock(), CWeakExecuteGuard::Lock(), CMainLoopThread::Main(), SGridWorkerNodeImpl::OfflineRun(), CAppJobDispatcher::OnEngineJobStateChanged(), CNamedPipeHandle::Open(), SRetryProcessing::operator()(), CObjectManagerEngine::PrefetchNotify(), CGridCgiApplication::ProcessRequest(), CPipeHandle::Read(), CProjectServiceTestJob::Run(), CPrimeNumbersJob::Run(), CPeriodicTestJob::Run(), CGetAssembliesJob::Run(), CSeqDBDemo_Threaded::Run(), SGridWorkerNodeImpl::Run(), CAppJobTestApplication::Run(), CGridClientSampleApp::Run(), CSampleNetScheduleClient::Run(), CSampleNetScheduleNode::Run(), CRemoteAppClientSampleApp::Run(), s_ConnectToNamedPipe(), s_GetObject(), s_PeekStdin(), s_ProcessErrorCode(), s_SimulateDelay(), CPrimeNumberClient::StartJobs(), CThreadGroup::SyncPoint(), CExec::Wait(), CProcess::Wait(), CThread::WaitForAllThreads(), CNamedPipeHandle::Write(), CPipeHandle::Write(), CThreadPoolEngine::x_OnTaskStatusChange(), CPipeHandle::x_Poll(), CNSTDatabase::x_PreCheckConnection(), CAppJobDispatcher::x_StartJob(), CNamedPipeHandle::x_WaitForRead(), and CAsyncWriteCache::~CAsyncWriteCache().
◆ SleepSec()Sleep.
Suspend execution for a time.
Sleep for at least the specified number of microsec/millisec/seconds. Time slice restrictions are imposed by platform/OS. On UNIX the sleep can be interrupted by a signal. Sleep*Sec(0) have no effect (but may cause context switches).
[UNIX & Windows]
Definition at line 1333 of file ncbi_system.cpp.
References kMicroSecondsPerSecond, and SleepMicroSec().
Referenced by BOOST_AUTO_TEST_CASE(), CheckWrittenFile(), CSampleJob::Do(), CEUtilsUpdater::DoPubSearch(), fta_get_gi_for_seq_id(), CGenomicCollectionsService::GetEquivalentAssemblies(), CPMCIDConverterServer::GetPmids(), CFastCgiMTSampleRequestProcessor::ProcessRequest(), PromoteIfDifferent(), CSampleIdleTask::Run(), SGridWorkerNodeImpl::Run(), CDemoApp::Run(), CHydraServer::RunHydraSearch(), fix_pub::s_GetESearchIds(), fix_pub::s_IsIndexed(), CRequestRateControl::Sleep(), TestDelay(), CEUtilsGeneric::TryQuery(), CGenomicCollectionsService::ValidateChrType(), CRPCClient_Base::x_Ask(), CRemoteBlast::x_CheckResults(), CRemoteBlast::x_CheckResultsDC(), CGenomicCollectionsService::x_FindAssembliesBySequences(), CMainLoopThread::x_GetNextJob(), CRemoteBlast::x_PollUntilDone(), and FileMessenger::~FileMessenger().
◆ SuppressSystemMessageBox()Suppress popup messages on execution errors.
NOTE: MS Windows-specific. Suppresses all error message boxes in both runtime and in debug libraries, as well as all General Protection Fault messages.
Definition at line 1383 of file ncbi_system.cpp.
References _SEH_Handler(), fSuppress_Debug, fSuppress_Exception, fSuppress_Runtime, fSuppress_System, s_DoneSuppressSystemMessageBox, s_EnableSuppressSystemMessageBox, and s_SuppressedDebugSystemMessageBox.
Referenced by CNcbiApplicationAPI::AppMain(), CCgiApplication::CCgiApplication(), InitDiagHandler(), main(), and CNcbiTestApplication::x_SetupBoostReporters().
◆ VerifyCpuCompatibility() ◆ s_CpuTimeLimit size_t s_CpuTimeLimit = 0 static ◆ s_DoneSuppressSystemMessageBox ◆ s_EnableSuppressSystemMessageBox bool s_EnableSuppressSystemMessageBox = true static ◆ s_IsHandlerActive std::atomic<bool> s_IsHandlerActive { false } ◆ s_IsHandlerSet ◆ s_MemoryLimitHard size_t s_MemoryLimitHard = 0 static ◆ s_MemoryLimitSoft size_t s_MemoryLimitSoft = 0 static ◆ s_PrintHandler ◆ s_PrintHandlerParam ◆ s_Reason ◆ s_ReservedMemory ◆ s_SuppressedDebugSystemMessageBox bool s_SuppressedDebugSystemMessageBox = false static ◆ s_TimeSetRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4