|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Manages memory quota with tracking and throttling. More...
#include <resource_manager.h>

Public Member Functions | |
| memory_quota_manager (const std::string &name, const resource_quota "a) | |
| memory_quota_manager (const std::string &name, size_t max_bytes, throttling_strategy strategy=throttling_strategy::reject) | |
| common::Result< bool > | allocate (size_t bytes) |
| Allocate memory from the quota. | |
| void | deallocate (size_t bytes) |
| Deallocate memory back to the quota. | |
| size_t | current_usage () const |
| Get current memory usage. | |
| bool | is_over_warning_threshold () const |
| Check if usage is over warning threshold. | |
| bool | is_over_critical_threshold () const |
| Check if usage is over critical threshold. | |
| resource_metrics | get_metrics () const |
| Get current metrics. | |
| const std::string & | get_name () const |
| Get the name of this manager. | |
Private Attributes | |
| std::string | name_ |
| resource_quota | quota_ |
| resource_metrics | metrics_ |
| std::mutex | mutex_ |
Manages memory quota with tracking and throttling.
Definition at line 317 of file resource_manager.h.
|
inline |
Definition at line 319 of file resource_manager.h.
|
inline |
Definition at line 322 of file resource_manager.h.
|
inline |
Allocate memory from the quota.
| bytes | Number of bytes to allocate |
Definition at line 331 of file resource_manager.h.
References kcenon::monitoring::resource_metrics::current_usage, kcenon::monitoring::resource_quota::max_value, metrics_, mutex_, name_, kcenon::monitoring::resource_metrics::peak_usage, quota_, kcenon::monitoring::resource_metrics::rejected_operations, kcenon::monitoring::resource_exhausted, and kcenon::monitoring::resource_metrics::total_allocations.
|
inline |
Get current memory usage.
Definition at line 366 of file resource_manager.h.
References kcenon::monitoring::resource_metrics::current_usage, and metrics_.
|
inline |
Deallocate memory back to the quota.
| bytes | Number of bytes to deallocate |
Definition at line 357 of file resource_manager.h.
References kcenon::monitoring::resource_metrics::current_usage, metrics_, and mutex_.
|
inline |
|
inline |
|
inline |
Check if usage is over critical threshold.
Definition at line 380 of file resource_manager.h.
References kcenon::monitoring::resource_quota::critical_threshold, kcenon::monitoring::resource_metrics::current_usage, metrics_, and quota_.
|
inline |
Check if usage is over warning threshold.
Definition at line 373 of file resource_manager.h.
References kcenon::monitoring::resource_metrics::current_usage, metrics_, quota_, and kcenon::monitoring::resource_quota::warning_threshold.
|
mutableprivate |
Definition at line 401 of file resource_manager.h.
Referenced by allocate(), current_usage(), deallocate(), get_metrics(), is_over_critical_threshold(), and is_over_warning_threshold().
|
mutableprivate |
Definition at line 402 of file resource_manager.h.
Referenced by allocate(), and deallocate().
|
private |
Definition at line 399 of file resource_manager.h.
Referenced by allocate(), and get_name().
|
private |
Definition at line 400 of file resource_manager.h.
Referenced by allocate(), is_over_critical_threshold(), and is_over_warning_threshold().