Collects, serializes and deserializes system-wide statistics. More...
#include <StatsSystem.h>
Public Types | |
enum | Category { CPUINFO = 0x0001, CPU = 0x0002, LOADAVG = 0x0004, MEMORY = 0x0008, DISK = 0x0010, SWAP = 0x0020, NETINFO = 0x0040, NET = 0x0080, OSINFO = 0x0100, PROCINFO = 0x0200, PROC = 0x0400, FS = 0x0800, TERMINFO = 0x1000 } |
All statistics categories that are provided by this class. More... | |
Public Member Functions | |
StatsSystem () | |
Default constructor; creates an empty object. More... | |
StatsSystem (int32_t categories) | |
Constructor; collects the specified categories. More... | |
StatsSystem (int32_t categories, std::vector< String > &dirs) | |
Constructor; collects the specified categories. More... | |
void | add_categories (int32_t categories) |
Adds more categories to the already existing categories. More... | |
void | add_categories (int32_t categories, std::vector< String > &dirs) |
Adds more categories and data directories. More... | |
void | refresh () |
Refreshes the statistics. More... | |
bool | operator== (const StatsSystem &other) const |
Equal operator. More... | |
bool | operator!= (const StatsSystem &other) const |
Not Equal operator. More... | |
Public Member Functions inherited from Hypertable::StatsSerializable | |
StatsSerializable (uint16_t _id, uint8_t _group_count) | |
Constructor; creates a new object with an ID and a number of groups. More... | |
StatsSerializable (const StatsSerializable &other) | |
Copy constructor. More... | |
StatsSerializable & | operator= (const StatsSerializable &other) |
Assignment operator. More... | |
size_t | encoded_length () const |
Returns the encoded length of this object. More... | |
void | encode (uint8_t **bufp) const |
Encodes the statistics to a serialized buffer. More... | |
void | decode (const uint8_t **bufp, size_t *remainp) |
Deserializes this object from a buffer. More... | |
bool | operator== (const StatsSerializable &other) const |
Equal operator. More... | |
bool | operator!= (const StatsSerializable &other) const |
Not Equal operator. More... | |
Public Attributes | |
struct CpuInfo | cpu_info |
CPU information (vendor, model, cores, cache sizes etc) More... | |
struct CpuStat | cpu_stat |
CPU statistics (user load, system load, idle etc) More... | |
struct LoadAvgStat | loadavg_stat |
Load average normalized over number of cores. More... | |
struct MemStat | mem_stat |
Memory statistics (total size, free space, used etc) More... | |
struct SwapStat | swap_stat |
Swapping statistics (page in, page out etc) More... | |
struct NetInfo | net_info |
Network information (host name, primary interface, gateway etc) More... | |
struct NetStat | net_stat |
Network statistics (transfer rates, receiving rate etc) More... | |
struct OsInfo | os_info |
OS information (name, architecture, version etc) More... | |
struct ProcInfo | proc_info |
Process information (pid, user, working directory etc) More... | |
struct ProcStat | proc_stat |
Process statistics (CPU user time, system time, vm size etc) More... | |
struct TermInfo | term_info |
Terminal information (number of lines, number of columns etc) More... | |
std::vector< struct DiskStat > | disk_stat |
Per-Disk statistics (read-rate, write-rate, etc) More... | |
std::vector< struct FsStat > | fs_stat |
Filesystem statistics (free space, used space, aggregate files etc) More... | |
Protected Member Functions | |
virtual size_t | encoded_length_group (int group) const |
Returns the encoded length of a statistics group. More... | |
virtual void | encode_group (int group, uint8_t **bufp) const |
Serializes a statistics group to memory. More... | |
virtual void | decode_group (int group, uint16_t len, const uint8_t **bufp, size_t *remainp) |
Deserializes a statistics group from memory. More... | |
Private Attributes | |
int32_t | m_categories |
Additional Inherited Members | |
Protected Types inherited from Hypertable::StatsSerializable | |
enum | Identifier { SYSTEM = 1, RANGE = 2, TABLE = 3, RANGE_SERVER = 4 } |
Statistics identifer; assigned in constructor. More... | |
Protected Attributes inherited from Hypertable::StatsSerializable | |
uint16_t | id |
The statistics ID. More... | |
uint8_t | group_count |
Number of groups in group_ids. More... | |
uint8_t | group_ids [32] |
The actual group IDs. More... | |
Collects, serializes and deserializes system-wide statistics.
Definition at line 43 of file StatsSystem.h.
|
inline |
Default constructor; creates an empty object.
Definition at line 63 of file StatsSystem.h.
StatsSystem::StatsSystem | ( | int32_t | categories | ) |
Constructor; collects the specified categories.
categories | bit-wise ORed categories |
Definition at line 55 of file StatsSystem.cc.
StatsSystem::StatsSystem | ( | int32_t | categories, |
std::vector< String > & | dirs | ||
) |
Constructor; collects the specified categories.
categories | bit-wise ORed categories |
dirs | Vector of data directories which are monitored |
Definition at line 62 of file StatsSystem.cc.
void StatsSystem::add_categories | ( | int32_t | categories | ) |
Adds more categories to the already existing categories.
Definition at line 69 of file StatsSystem.cc.
void StatsSystem::add_categories | ( | int32_t | categories, |
std::vector< String > & | dirs | ||
) |
Adds more categories and data directories.
Definition at line 117 of file StatsSystem.cc.
|
protectedvirtual |
Deserializes a statistics group from memory.
Implements Hypertable::StatsSerializable.
Definition at line 427 of file StatsSystem.cc.
|
protectedvirtual |
Serializes a statistics group to memory.
Implements Hypertable::StatsSerializable.
Definition at line 300 of file StatsSystem.cc.
|
protectedvirtual |
Returns the encoded length of a statistics group.
Implements Hypertable::StatsSerializable.
Definition at line 225 of file StatsSystem.cc.
|
inline |
Not Equal operator.
Definition at line 92 of file StatsSystem.h.
bool StatsSystem::operator== | ( | const StatsSystem & | other | ) | const |
Equal operator.
Definition at line 168 of file StatsSystem.cc.
void StatsSystem::refresh | ( | ) |
Refreshes the statistics.
Definition at line 141 of file StatsSystem.cc.
struct CpuInfo Hypertable::StatsSystem::cpu_info |
CPU information (vendor, model, cores, cache sizes etc)
Definition at line 97 of file StatsSystem.h.
struct CpuStat Hypertable::StatsSystem::cpu_stat |
CPU statistics (user load, system load, idle etc)
Definition at line 100 of file StatsSystem.h.
std::vector<struct DiskStat> Hypertable::StatsSystem::disk_stat |
Per-Disk statistics (read-rate, write-rate, etc)
Definition at line 130 of file StatsSystem.h.
std::vector<struct FsStat> Hypertable::StatsSystem::fs_stat |
Filesystem statistics (free space, used space, aggregate files etc)
Definition at line 133 of file StatsSystem.h.
struct LoadAvgStat Hypertable::StatsSystem::loadavg_stat |
Load average normalized over number of cores.
Definition at line 103 of file StatsSystem.h.
|
private |
Definition at line 147 of file StatsSystem.h.
struct MemStat Hypertable::StatsSystem::mem_stat |
Memory statistics (total size, free space, used etc)
Definition at line 106 of file StatsSystem.h.
struct NetInfo Hypertable::StatsSystem::net_info |
Network information (host name, primary interface, gateway etc)
Definition at line 112 of file StatsSystem.h.
struct NetStat Hypertable::StatsSystem::net_stat |
Network statistics (transfer rates, receiving rate etc)
Definition at line 115 of file StatsSystem.h.
struct OsInfo Hypertable::StatsSystem::os_info |
OS information (name, architecture, version etc)
Definition at line 118 of file StatsSystem.h.
struct ProcInfo Hypertable::StatsSystem::proc_info |
Process information (pid, user, working directory etc)
Definition at line 121 of file StatsSystem.h.
struct ProcStat Hypertable::StatsSystem::proc_stat |
Process statistics (CPU user time, system time, vm size etc)
Definition at line 124 of file StatsSystem.h.
struct SwapStat Hypertable::StatsSystem::swap_stat |
Swapping statistics (page in, page out etc)
Definition at line 109 of file StatsSystem.h.
struct TermInfo Hypertable::StatsSystem::term_info |
Terminal information (number of lines, number of columns etc)
Definition at line 127 of file StatsSystem.h.