TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
cpid::Cpid2kMetrics Class Reference

Helper class to aggregate metrics locally, and send them reguarly as events in the redis database as key 'prefix:metricEvents'. More...

#include <cpid2kworker.h>

Classes

struct  Aggregator
 
struct  EventMetric
 

Public Types

enum  AggregationType {
  AggregateMean, AggregateSum, AggregateMin, AggregateMax,
  AggregateLast
}
 

Public Member Functions

 Cpid2kMetrics (std::shared_ptr< Cpid2kWorker > worker, std::chrono::milliseconds sendInterval=std::chrono::seconds(30))
 
 ~Cpid2kMetrics ()
 
void push (std::vector< EventMetric > const &metrics)
 

Protected Types

using Clock = std::chrono::steady_clock
 

Protected Member Functions

void run ()
 

Protected Attributes

std::shared_ptr< Cpid2kWorkerworker_
 
std::chrono::milliseconds sendInterval_
 
std::thread thr_
 
std::atomic< bool > stop_
 
std::mutex aggregatorsMutex_
 
std::unordered_map< std::string, std::unique_ptr< Aggregator > > aggregators_
 

Detailed Description

Helper class to aggregate metrics locally, and send them reguarly as events in the redis database as key 'prefix:metricEvents'.

Member Typedef Documentation

using cpid::Cpid2kMetrics::Clock = std::chrono::steady_clock
protected

Member Enumeration Documentation

Enumerator
AggregateMean 
AggregateSum 
AggregateMin 
AggregateMax 
AggregateLast 

Constructor & Destructor Documentation

cpid::Cpid2kMetrics::Cpid2kMetrics ( std::shared_ptr< Cpid2kWorker worker,
std::chrono::milliseconds  sendInterval = std::chrono::seconds(30) 
)
cpid::Cpid2kMetrics::~Cpid2kMetrics ( )

Member Function Documentation

void cpid::Cpid2kMetrics::push ( std::vector< EventMetric > const &  metrics)
void cpid::Cpid2kMetrics::run ( )
protected

Member Data Documentation

std::unordered_map<std::string, std::unique_ptr<Aggregator> > cpid::Cpid2kMetrics::aggregators_
protected
std::mutex cpid::Cpid2kMetrics::aggregatorsMutex_
protected
std::chrono::milliseconds cpid::Cpid2kMetrics::sendInterval_
protected
std::atomic<bool> cpid::Cpid2kMetrics::stop_
protected
std::thread cpid::Cpid2kMetrics::thr_
protected
std::shared_ptr<Cpid2kWorker> cpid::Cpid2kMetrics::worker_
protected

The documentation for this class was generated from the following files: