SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
SWC::System::Resources Class Referencefinal

#include <swcdb/common/sys/Resources.h>

+ Collaboration diagram for SWC::System::Resources:

Public Member Functions

SWC_SHOULD_NOT_INLINE Resources (const Comm::IoContextPtr &ioctx, Config::Property::Value_int32_g::Ptr ram_percent_allowed, Config::Property::Value_int32_g::Ptr ram_percent_reserved, Config::Property::Value_int32_g::Ptr ram_release_rate, Notifier *notifier=nullptr, Mem::ReleaseCall_t &&release_call=nullptr)
 
 Resources (const Resources &other)=delete
 
 Resources (Resources &&other)=delete
 
Resources operator= (const Resources &other)=delete
 
Resources operator= (Resources &&other)=delete
 
 ~Resources () noexcept
 
SWC_CAN_INLINE bool is_low_mem_state () const noexcept
 
SWC_CAN_INLINE size_t need_ram () const noexcept
 
SWC_CAN_INLINE size_t avail_ram () const noexcept
 
SWC_CAN_INLINE bool need_ram (uint32_t sz) const noexcept
 
SWC_CAN_INLINE void more_mem_future (size_t sz) noexcept
 
SWC_CAN_INLINE void less_mem_future (size_t sz) noexcept
 
SWC_CAN_INLINE void more_mem_releasable (size_t sz) noexcept
 
SWC_CAN_INLINE void less_mem_releasable (size_t sz) noexcept
 
SWC_CAN_INLINE void adj_mem_releasable (ssize_t sz) noexcept
 
SWC_CAN_INLINE uint32_t available_mem_mb () const noexcept
 
SWC_CAN_INLINE uint32_t concurrency () const noexcept
 
SWC_CAN_INLINE uint32_t available_cpu_mhz () const noexcept
 
SWC_CAN_INLINE uint32_t cpu_usage () const noexcept
 
void stop ()
 
SWC_SHOULD_NOT_INLINE void print (std::ostream &out) const
 

Public Attributes

CPU cpu
 
Mem mem
 

Private Member Functions

SWC_SHOULD_NOT_INLINE void checker () noexcept
 
SWC_CAN_INLINE void schedule (uint64_t intval)
 

Private Attributes

Core::CompletionCounter< uint8_t > running
 
Core::MutexAtomic m_mutex_timer
 
asio::steady_timer m_timer
 

Detailed Description

Definition at line 50 of file Resources.h.

Constructor & Destructor Documentation

◆ Resources() [1/3]

SWC_SHOULD_NOT_INLINE SWC::System::Resources::Resources ( const Comm::IoContextPtr ioctx,
Config::Property::Value_int32_g::Ptr  ram_percent_allowed,
Config::Property::Value_int32_g::Ptr  ram_percent_reserved,
Config::Property::Value_int32_g::Ptr  ram_release_rate,
Notifier notifier = nullptr,
Mem::ReleaseCall_t &&  release_call = nullptr 
)
inline

Definition at line 56 of file Resources.h.

References checker().

+ Here is the call graph for this function:

◆ Resources() [2/3]

SWC::System::Resources::Resources ( const Resources other)
delete

◆ Resources() [3/3]

SWC::System::Resources::Resources ( Resources &&  other)
delete

◆ ~Resources()

SWC::System::Resources::~Resources ( )
inlinenoexcept

Definition at line 81 of file Resources.h.

Member Function Documentation

◆ adj_mem_releasable()

SWC_CAN_INLINE void SWC::System::Resources::adj_mem_releasable ( ssize_t  sz)
inlinenoexcept

Definition at line 124 of file Resources.h.

References SWC::System::Mem::adj_mem_releasable(), and mem.

Referenced by SWC::Ranger::CommitLog::Fragments::_commit(), SWC::Ranger::Block::_split(), SWC::Ranger::CommitLog::Fragments::commit(), SWC::Ranger::Block::load_cells(), and SWC::Ranger::Block::load_final().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avail_ram()

SWC_CAN_INLINE size_t SWC::System::Resources::avail_ram ( ) const
inlinenoexcept

Definition at line 94 of file Resources.h.

References SWC::System::Mem::avail_ram(), and mem.

Referenced by SWC::Ranger::CommitLog::Compact::Compact(), and SWC::Ranger::CompactRange::request_more().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ available_cpu_mhz()

SWC_CAN_INLINE uint32_t SWC::System::Resources::available_cpu_mhz ( ) const
inlinenoexcept

Definition at line 139 of file Resources.h.

References cpu, and SWC::System::CPU::mhz.

◆ available_mem_mb()

SWC_CAN_INLINE uint32_t SWC::System::Resources::available_mem_mb ( ) const
inlinenoexcept

Definition at line 129 of file Resources.h.

References SWC::System::Mem::available_mem_mb(), and mem.

+ Here is the call graph for this function:

◆ checker()

SWC_SHOULD_NOT_INLINE void SWC::System::Resources::checker ( )
inlineprivatenoexcept

Definition at line 171 of file Resources.h.

References SWC::System::CPU::check(), SWC::System::Mem::check(), cpu, SWC::Core::CompletionCounter< CountT >::increment(), mem, SWC::Time::now_ms(), running, schedule(), and SWC_LOG_CURRENT_EXCEPTION.

Referenced by Resources(), and schedule().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ concurrency()

SWC_CAN_INLINE uint32_t SWC::System::Resources::concurrency ( ) const
inlinenoexcept

Definition at line 134 of file Resources.h.

References SWC::System::CPU::concurrency, and cpu.

Referenced by SWC::Ranger::CommitLog::Compact::Compact(), SWC::Manager::MngdColumns::initialize(), and SWC::Ranger::Columns::unload().

+ Here is the caller graph for this function:

◆ cpu_usage()

SWC_CAN_INLINE uint32_t SWC::System::Resources::cpu_usage ( ) const
inlinenoexcept

Definition at line 144 of file Resources.h.

References cpu, and SWC::System::CPU::usage.

◆ is_low_mem_state()

SWC_CAN_INLINE bool SWC::System::Resources::is_low_mem_state ( ) const
inlinenoexcept

Definition at line 84 of file Resources.h.

References SWC::System::Mem::is_low_mem_state(), and mem.

Referenced by SWC::Ranger::Compaction::available(), and SWC::Comm::Protocol::Rgr::Handler::RangeQuerySelect::operator()().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ less_mem_future()

SWC_CAN_INLINE void SWC::System::Resources::less_mem_future ( size_t  sz)
inlinenoexcept

Definition at line 109 of file Resources.h.

References SWC::System::Mem::less_mem_future(), and mem.

Referenced by SWC::Ranger::CommitLog::Fragments::_commit(), SWC::Ranger::CommitLog::Compact::Group::_loaded(), SWC::Ranger::Compaction::compacted(), SWC::Ranger::CellStore::Block::Read::load_finish(), SWC::Ranger::CommitLog::Fragment::load_finish(), SWC::Ranger::Block::preload(), and SWC::Ranger::Callback::RangeQueryUpdate::~RangeQueryUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ less_mem_releasable()

SWC_CAN_INLINE void SWC::System::Resources::less_mem_releasable ( size_t  sz)
inlinenoexcept

◆ more_mem_future()

SWC_CAN_INLINE void SWC::System::Resources::more_mem_future ( size_t  sz)
inlinenoexcept

Definition at line 104 of file Resources.h.

References mem, and SWC::System::Mem::more_mem_future().

Referenced by SWC::Ranger::CommitLog::Fragments::_commit(), SWC::Ranger::CommitLog::Compact::Group::_loaded(), SWC::Ranger::Compaction::compact(), SWC::Ranger::CellStore::Block::Read::load(), SWC::Ranger::CommitLog::Fragment::load(), SWC::Ranger::Block::preload(), and SWC::Ranger::Callback::RangeQueryUpdate::RangeQueryUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ more_mem_releasable()

SWC_CAN_INLINE void SWC::System::Resources::more_mem_releasable ( size_t  sz)
inlinenoexcept

Definition at line 114 of file Resources.h.

References mem, and SWC::System::Mem::more_mem_releasable().

Referenced by SWC::Ranger::Block::Block(), SWC::Ranger::CommitLog::Fragment::Fragment(), SWC::Ranger::CellStore::Block::Read::load(), SWC::Ranger::CommitLog::Fragment::load(), and SWC::ThriftBroker::AppHandler::updater_create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ need_ram() [1/2]

SWC_CAN_INLINE size_t SWC::System::Resources::need_ram ( ) const
inlinenoexcept

Definition at line 89 of file Resources.h.

References mem, and SWC::System::Mem::need_ram().

Referenced by SWC::Ranger::CommitLog::Fragments::_need_roll(), SWC::Ranger::Blocks::_split(), SWC::Ranger::CellStore::Block::Read::load_cells(), SWC::Ranger::CommitLog::Fragment::load_cells(), and SWC::Ranger::Blocks::scan().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ need_ram() [2/2]

SWC_CAN_INLINE bool SWC::System::Resources::need_ram ( uint32_t  sz) const
inlinenoexcept

Definition at line 99 of file Resources.h.

References mem, and SWC::System::Mem::need_ram().

+ Here is the call graph for this function:

◆ operator=() [1/2]

Resources SWC::System::Resources::operator= ( const Resources other)
delete

◆ operator=() [2/2]

Resources SWC::System::Resources::operator= ( Resources &&  other)
delete

◆ print()

SWC_SHOULD_NOT_INLINE void SWC::System::Resources::print ( std::ostream &  out) const
inline

Definition at line 161 of file Resources.h.

References cpu, mem, SWC::System::CPU::print(), and SWC::System::Mem::print().

+ Here is the call graph for this function:

◆ schedule()

SWC_CAN_INLINE void SWC::System::Resources::schedule ( uint64_t  intval)
inlineprivate

Definition at line 184 of file Resources.h.

References checker(), SWC::Core::CompletionCounter< CountT >::is_last(), m_mutex_timer, m_timer, running, and SWC_CAN_INLINE.

Referenced by checker().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stop()

void SWC::System::Resources::stop ( )
inline

Definition at line 148 of file Resources.h.

References SWC::Core::CompletionCounter< CountT >::count(), m_mutex_timer, m_timer, and running.

Referenced by SWC::Env::Bkr::_shuttingdown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ cpu

CPU SWC::System::Resources::cpu

Definition at line 52 of file Resources.h.

Referenced by available_cpu_mhz(), checker(), concurrency(), cpu_usage(), and print().

◆ m_mutex_timer

Core::MutexAtomic SWC::System::Resources::m_mutex_timer
private

Definition at line 201 of file Resources.h.

Referenced by schedule(), and stop().

◆ m_timer

asio::steady_timer SWC::System::Resources::m_timer
private

Definition at line 202 of file Resources.h.

Referenced by schedule(), and stop().

◆ mem

◆ running

Core::CompletionCounter<uint8_t> SWC::System::Resources::running
private

Definition at line 200 of file Resources.h.

Referenced by checker(), schedule(), and stop().


The documentation for this class was generated from the following file: