|
Network System 0.1.1
High-performance modular networking library for scalable client-server applications
|
#include <memory_profiler.h>

Public Member Functions | |
| void | start (std::chrono::milliseconds interval=std::chrono::milliseconds{1000}) |
| void | stop () |
| memory_snapshot | snapshot () |
| std::vector< memory_snapshot > | get_history (std::size_t max_count=256) const |
| void | clear_history () |
| std::string | to_tsv () const |
Static Public Member Functions | |
| static memory_profiler & | instance () |
Private Member Functions | |
| memory_profiler ()=default | |
| ~memory_profiler () | |
| memory_profiler (const memory_profiler &)=delete | |
| memory_profiler & | operator= (const memory_profiler &)=delete |
| void | schedule_next_sample () |
Static Private Member Functions | |
| static bool | query_process_memory (std::uint64_t &rss, std::uint64_t &vms) |
Private Attributes | |
| std::atomic< bool > | running_ {false} |
| std::chrono::milliseconds | sampling_interval_ {1000} |
| std::mutex | mutex_ {} |
| std::vector< memory_snapshot > | history_ {} |
| std::size_t | max_history_ {4096} |
Definition at line 32 of file memory_profiler.h.
|
privatedefault |
|
private |
Definition at line 29 of file memory_profiler.cpp.
References stop().

|
privatedelete |
| void kcenon::network::utils::memory_profiler::clear_history | ( | ) |
Definition at line 70 of file memory_profiler.cpp.
| std::vector< memory_snapshot > kcenon::network::utils::memory_profiler::get_history | ( | std::size_t | max_count = 256 | ) | const |
|
static |
Definition at line 24 of file memory_profiler.cpp.
|
privatedelete |
|
staticprivate |
Definition at line 104 of file memory_profiler.cpp.
Referenced by snapshot().

|
private |
Definition at line 88 of file memory_profiler.cpp.
References kcenon::network::integration::thread_integration_manager::instance(), running_, sampling_interval_, schedule_next_sample(), snapshot(), and kcenon::network::integration::thread_integration_manager::submit_delayed_task().
Referenced by schedule_next_sample(), and start().


| memory_snapshot kcenon::network::utils::memory_profiler::snapshot | ( | ) |
Definition at line 48 of file memory_profiler.cpp.
References history_, max_history_, mutex_, query_process_memory(), kcenon::network::utils::memory_snapshot::resident_bytes, kcenon::network::utils::memory_snapshot::timestamp, and kcenon::network::utils::memory_snapshot::virtual_bytes.
Referenced by schedule_next_sample().


| void kcenon::network::utils::memory_profiler::start | ( | std::chrono::milliseconds | interval = std::chrono::milliseconds{1000} | ) |
Definition at line 31 of file memory_profiler.cpp.
References running_, sampling_interval_, and schedule_next_sample().

| void kcenon::network::utils::memory_profiler::stop | ( | ) |
Definition at line 42 of file memory_profiler.cpp.
References running_.
Referenced by ~memory_profiler().

| std::string kcenon::network::utils::memory_profiler::to_tsv | ( | ) | const |
Definition at line 75 of file memory_profiler.cpp.
|
private |
Definition at line 69 of file memory_profiler.h.
Referenced by clear_history(), get_history(), snapshot(), and to_tsv().
|
private |
|
mutableprivate |
Definition at line 68 of file memory_profiler.h.
Referenced by clear_history(), get_history(), snapshot(), and to_tsv().
|
private |
Definition at line 66 of file memory_profiler.h.
Referenced by schedule_next_sample(), start(), and stop().
|
private |
Definition at line 67 of file memory_profiler.h.
Referenced by schedule_next_sample(), and start().