You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
Reformat all code to coding standard
This commit is contained in:
@ -44,78 +44,85 @@ namespace utils
|
||||
*/
|
||||
class MonitorProcMem
|
||||
{
|
||||
public:
|
||||
/** @brief MonitorProcMem constructor
|
||||
*
|
||||
* @param maxPct (in) maximum allowable memory usage
|
||||
* @param memChk (in) monitor total system physical memory usage
|
||||
* @param msgLog (in) message logger to log msg to
|
||||
* @param sec (in) number of seconds between memory checks
|
||||
*/
|
||||
explicit MonitorProcMem(size_t maxPct,
|
||||
size_t memChk,
|
||||
uint32_t subsystemID,
|
||||
unsigned sec=1) :
|
||||
fPid ( getpid() ),
|
||||
fMaxPct ( maxPct ),
|
||||
fSleepSec ( sec ),
|
||||
fSubsystemID ( subsystemID ),
|
||||
fPageSize ( getpagesize() ) { fMemPctCheck = memChk; fMemTotal = memTotal(); }
|
||||
public:
|
||||
/** @brief MonitorProcMem constructor
|
||||
*
|
||||
* @param maxPct (in) maximum allowable memory usage
|
||||
* @param memChk (in) monitor total system physical memory usage
|
||||
* @param msgLog (in) message logger to log msg to
|
||||
* @param sec (in) number of seconds between memory checks
|
||||
*/
|
||||
explicit MonitorProcMem(size_t maxPct,
|
||||
size_t memChk,
|
||||
uint32_t subsystemID,
|
||||
unsigned sec = 1) :
|
||||
fPid ( getpid() ),
|
||||
fMaxPct ( maxPct ),
|
||||
fSleepSec ( sec ),
|
||||
fSubsystemID ( subsystemID ),
|
||||
fPageSize ( getpagesize() )
|
||||
{
|
||||
fMemPctCheck = memChk;
|
||||
fMemTotal = memTotal();
|
||||
}
|
||||
|
||||
virtual ~MonitorProcMem() {};
|
||||
virtual ~MonitorProcMem() {};
|
||||
|
||||
/** @brief Thread entry point
|
||||
*
|
||||
* Entry point for this thread that monitors memory usage.
|
||||
*/
|
||||
virtual void operator()() const;
|
||||
/** @brief Thread entry point
|
||||
*
|
||||
* Entry point for this thread that monitors memory usage.
|
||||
*/
|
||||
virtual void operator()() const;
|
||||
|
||||
/* Accessor to return the free memory
|
||||
*
|
||||
*/
|
||||
size_t getFreeMem() const {return fMemFree;}
|
||||
/* Accessor to return the free memory
|
||||
*
|
||||
*/
|
||||
size_t getFreeMem() const
|
||||
{
|
||||
return fMemFree;
|
||||
}
|
||||
|
||||
/* return the % of total memory used
|
||||
*
|
||||
*/
|
||||
static unsigned memUsedPct();
|
||||
/* return the % of total memory used
|
||||
*
|
||||
*/
|
||||
static unsigned memUsedPct();
|
||||
|
||||
/* return true if memory usage is below configured limit
|
||||
*
|
||||
*/
|
||||
static bool isMemAvailable(size_t memRequest = 0);
|
||||
/* return true if memory usage is below configured limit
|
||||
*
|
||||
*/
|
||||
static bool isMemAvailable(size_t memRequest = 0);
|
||||
|
||||
protected:
|
||||
//Defaults are okay
|
||||
//MonitorProcMem (const MonitorProcMem& rhs);
|
||||
//MonitorProcMem& operator=(const MonitorProcMem& rhs);
|
||||
//Defaults are okay
|
||||
//MonitorProcMem (const MonitorProcMem& rhs);
|
||||
//MonitorProcMem& operator=(const MonitorProcMem& rhs);
|
||||
|
||||
/** return the current process RSS size in MB
|
||||
*
|
||||
*/
|
||||
size_t rss() const;
|
||||
/** return the current process RSS size in MB
|
||||
*
|
||||
*/
|
||||
size_t rss() const;
|
||||
|
||||
/* return the system RAM size in MB
|
||||
*
|
||||
*/
|
||||
size_t memTotal() const;
|
||||
/* return the system RAM size in MB
|
||||
*
|
||||
*/
|
||||
size_t memTotal() const;
|
||||
|
||||
/* pause for fSleepSec seconds between memory usage checks
|
||||
*
|
||||
*/
|
||||
void pause_() const;
|
||||
/* pause for fSleepSec seconds between memory usage checks
|
||||
*
|
||||
*/
|
||||
void pause_() const;
|
||||
|
||||
pid_t fPid; // process pid
|
||||
size_t fMaxPct; // max allowable % memory use
|
||||
unsigned fSleepSec; // sleep interval in seconds
|
||||
uint32_t fSubsystemID; // Subsystem ID for Logger
|
||||
int fPageSize; // page size for this host (in bytes)
|
||||
pid_t fPid; // process pid
|
||||
size_t fMaxPct; // max allowable % memory use
|
||||
unsigned fSleepSec; // sleep interval in seconds
|
||||
uint32_t fSubsystemID; // Subsystem ID for Logger
|
||||
int fPageSize; // page size for this host (in bytes)
|
||||
|
||||
// @bug4507, monitor % of total used system memory
|
||||
static uint64_t fMemTotal;
|
||||
static uint64_t fMemFree;
|
||||
static int fMemPctCheck;
|
||||
mutable CGroupConfigurator cg;
|
||||
// @bug4507, monitor % of total used system memory
|
||||
static uint64_t fMemTotal;
|
||||
static uint64_t fMemFree;
|
||||
static int fMemPctCheck;
|
||||
mutable CGroupConfigurator cg;
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user