18#include <shared_mutex>
19#include <unordered_map>
23namespace kcenon {
namespace monitoring {
64 common::Result<performance_profile>
get_profile(
const std::string& operation_name)
const;
145 std::unordered_map<std::string, std::unique_ptr<profile_data>>
profiles_;
Central collector for aggregating metrics from thread-local buffers.
size_t get_operation_count() const
Get the number of tracked operations.
std::atomic< size_t > total_samples_
std::shared_mutex profiles_mutex_
std::unordered_map< std::string, std::unique_ptr< profile_data > > profiles_
void clear()
Clear all collected data.
size_t get_total_sample_count() const
Get total number of samples received.
central_collector(size_t max_profiles=DEFAULT_MAX_PROFILES)
Construct a central collector.
std::atomic< size_t > batches_received_
std::atomic< size_t > lru_evictions_
common::Result< performance_profile > get_profile(const std::string &operation_name) const
Get aggregated profile for an operation.
void receive_batch(const std::vector< metric_sample > &samples)
Receive a batch of samples from a thread-local buffer.
std::unordered_map< std::string, performance_profile > get_all_profiles() const
Get all aggregated profiles.
static constexpr size_t DEFAULT_MAX_PROFILES
void process_sample(const metric_sample &sample)
Process a single sample into a profile.
void evict_lru()
Evict least recently used profile.
Monitoring system specific error codes.
Result pattern type definitions for monitoring system.
Internal structure for profile data with LRU tracking.
std::atomic< std::chrono::steady_clock::rep > last_access_time
performance_profile profile
Get statistics about the collector.
size_t total_samples
Total samples received.
size_t lru_evictions
Number of LRU evictions.
size_t batches_received
Total batches received.
size_t operation_count
Number of tracked operations.
Sample data structure for metric recording.
Thread-local buffer for lock-free metric collection.